SQL Data Types, Relationships, Keys, and Constraints Flashcards

Author: Martin Ganchev Cards: 71

Our SQL Data Types, Relationships, Keys, and Constraints Flashcards deck is an invaluable resource for beginners and professionals aiming to gain proficiency in SQL. It provides a detailed exploration of the structures that form the backbone of database design and query optimization. Discover answers to these and other fundamental questions: • What is the role of a primary key in SQL? • Which SQL keyword is used for creating local variables in MySQL? • What are constraints in SQL? Learn about the role of a unique identifier in a database—essential for distinguishing between records. Explore the different types of SQL relationships between database tables: one-to-many, one-to-one, and many-to-many—each with its own cardinality constraints. Enhance your understanding of primary keys and foreign keys in SQL. What is the primary key’s role in uniquely identifying records within a table, and how do foreign keys enforce referential integrity between tables? The deck also explains unique keys, guaranteeing record uniqueness, and composite keys—merging several fields to create a unique identifier for each record. Refresh your knowledge of such data storage concepts as storage size, precision, and scale—fundamental aspects that determine how data is stored and represented in a database. Discover how triggers—powerful database objects—automatically execute actions pre or post-data modifications, boosting the database operations' dynamism and integrity. The SQL flashcards deck also delves into crafting efficient SQL queries, covering the optimization of subqueries for enhanced performance, and introduces partitioning—a strategy for dividing large tables into smaller segments to boost query efficiency. Familiarize yourself with the various SQL data types—including numeric, alphanumeric, fixed-storage, and floating-point. This encompasses everything from strings, characters, and integers to more complex types like date, time, and binary large objects (BLOBs). Become well-acquainted with SQL constraints that enforce rules on the data in databases, such as NOT NULL, unique, default, and primary key constraints. The deck also touches on auto-increment fields for automatically generating unique record identifiers. Finally, the SQL Data Types, Relationships, Keys, and Constraints Flashcards cover syntax—including the declaration of variables, SET statements, and the importance of statement terminators. Essential SQL keywords and reserved words are also included, providing a comprehensive vocabulary for SQL programming. Whether you're building a foundation in database management or refining your SQL skills, this flashcards deck is an excellent tool for reinforcing your knowledge of database structures and query language. The key to SQL proficiency awaits. Don't delay—begin studying now!

Our SQL Data Types, Relationships, Keys, and Constraints Flashcards deck is an invaluable resource for beginners and professionals aiming to gain proficiency in SQL. It provides a detailed exploration of the structures that form the backbone of database design and query optimization. Discover answers to these and other fundamental questions: • What is the role of a primary key in SQL? • Which SQL keyword is used for creating local variables in MySQL? • What are constraints in SQL? Learn about the role of a unique identifier in a database—essential for distinguishing between records. Explore the different types of SQL relationships between database tables: one-to-many, one-to-one, and many-to-many—each with its own cardinality constraints. Enhance your understanding of primary keys and foreign keys in SQL. What is the primary key’s role in uniquely identifying records within a table, and how do foreign keys enforce referential integrity between tables? The deck also explains unique keys, guaranteeing record uniqueness, and composite keys—merging several fields to create a unique identifier for each record. Refresh your knowledge of such data storage concepts as storage size, precision, and scale—fundamental aspects that determine how data is stored and represented in a database. Discover how triggers—powerful database objects—automatically execute actions pre or post-data modifications, boosting the database operations' dynamism and integrity. The SQL flashcards deck also delves into crafting efficient SQL queries, covering the optimization of subqueries for enhanced performance, and introduces partitioning—a strategy for dividing large tables into smaller segments to boost query efficiency. Familiarize yourself with the various SQL data types—including numeric, alphanumeric, fixed-storage, and floating-point. This encompasses everything from strings, characters, and integers to more complex types like date, time, and binary large objects (BLOBs). Become well-acquainted with SQL constraints that enforce rules on the data in databases, such as NOT NULL, unique, default, and primary key constraints. The deck also touches on auto-increment fields for automatically generating unique record identifiers. Finally, the SQL Data Types, Relationships, Keys, and Constraints Flashcards cover syntax—including the declaration of variables, SET statements, and the importance of statement terminators. Essential SQL keywords and reserved words are also included, providing a comprehensive vocabulary for SQL programming. Whether you're building a foundation in database management or refining your SQL skills, this flashcards deck is an excellent tool for reinforcing your knowledge of database structures and query language. The key to SQL proficiency awaits. Don't delay—begin studying now!

Explore the Flashcards:

1 of 71

Unique Identifier in a Database

A value that uniquely identifies a record in a database table.

2 of 71

Relationships in Databases

Connections between tables in a database, typically defined by keys.

3 of 71

A One-to-many (Many-to-one) Relationship

A type of relationship in a database where a record in one table can be associated with one or more records in another table.

Many-to-one is the reverse of one-to-many.

4 of 71

A One-to-one Relationship

A type of relationship in a database where one record in a table is associated with one and only one record in another table.

5 of 71

A Many-to-many Relationship

A type of relationship in a database where multiple records in one table can be associated with multiple records in another table and vice versa.

6 of 71

Cardinality Constraints

Restrictions that define the number of instances that one entity can be associated with another entity in a relationship.

7 of 71

Primary Key

A column (or set of columns) in a table that uniquely identifies each row.

8 of 71

Foreign Key

A column (or set of columns) in a table whose values match the values of a column (or a set of columns) in another table from the database.

9 of 71

Unique Key

A field attribute ensuring no duplicate values within a column. Different from the primary key, a unique key can store a null value, but only one. A table can have multiple unique keys while it can have only one primary key. Unique keys allow modification and deletion of data, unlike primary keys.

10 of 71

Composite Key

A key that consists of two or more fields that are used together to uniquely identify a record in a table.

11 of 71

Null Value in Primary Key

A state that is not allowed in a primary key column, as primary keys must have a unique and non-null value for each row.

12 of 71

Base Tables

Tables in a database that physically store data, as opposed to views or derived tables which only refer to data physically stored in the base tables.

13 of 71

Child Table

A table in a database that has a foreign key referencing the primary key of another table.

14 of 71

Parent Table

A table in a database referenced by the foreign key in another table.

15 of 71

Referencing Table

A table in a database that includes a foreign key pointing to uniquely identified rows in another table.

16 of 71

Referenced Table

A table in a database containing uniquely identified rows to which another table's foreign key points.

17 of 71

Storage

The physical or virtual space used by a database to save data, with various mechanisms

in place to optimize performance and ensure data integrity.

18 of 71

Storage Size

The amount of disk space that a database object or an entire database occupies in SQL.

19 of 71

Precision

The number of digits in a number.

20 of 71

Scale

The number of digits to the right of the decimal point in a number.

21 of 71

Triggers

Database objects that automatically execute a predefined action when а certain data modification operation occurs.

22 of 71

BEFORE Trigger

A database trigger that executes before one or more specified data modification operations occur.

23 of 71

AFTER Trigger

A database trigger that executes after a specified data modification operation.

24 of 71

Query

A request for data from a database table or combination of tables. Information from the database can be retrieved and sorted in a variety of ways by writing the relevant queries.

25 of 71

Subquery (or nested query)

A query nested within another SQL query.

26 of 71

Query Optimization

The process of modifying a query to improve its efficiency and performance expressed in terms

of augmented speed of data retrieval and reduced resource consumption.

27 of 71

Query efficiency

A performance measure of a SQL query regarding speed and resource utilization.

28 of 71

Partitioning

Database partitioning (or data partitioning) is a database technique to divide a subset of the database data into separate chunks (or namely - partitions), that are yet being treated as a single data table. The idea behind using data partitions is that they can be stored, accessed, or managed one by one.

29 of 71

Variable

A placeholder used in programming and databases to store a value that can change

during the execution of a program or query.

30 of 71

Local Variables

Variables declared within a stored routine in SQL, accessible only within that routine.

31 of 71

Session Variables

Variables that are defined by the user and that can be accessed during a single session in a database.

32 of 71

Global Variables

Variables in a database that are accessible throughout the entirety of the server (i.e. that are available and maintained across different sessions).

33 of 71

DECLARE

Keyword used for creating local variables in MySQL.

34 of 71

SET Statement

A statement used for creating Session Variables in MySQL

35 of 71

Statement Terminator (in SQL)

A character or sequence of characters that indicate the end of an SQL statement.

36 of 71

Alphanumeric Data Types

Data types in SQL that can store both letters (alphabets) and numbers, but no other characters (such as punctuation marks or other symbols, for instance).

37 of 71

String

A sequence of characters used in programming and databases to represent text rather than numbers.

38 of 71

Length

In databases, "length" refers to the number of characters contained in a string.

39 of 71

Bytes

A unit of digital information in computing and telecommunications.

40 of 71

CHAR

A fixed-length character data type in SQL.

41 of 71

VARCHAR

A variable-length character data type in SQL.

42 of 71

ENUM

An SQL data type consisting of a set of named VALUES (NULL,ref. "enumeration").

43 of 71

Fixed-Storage Data Type

A data type in SQL having a fixed-space allocation.

44 of 71

Numeric Data Types

SQL data types representing numeric values.

45 of 71

Integer (INT)

An SQL data type for storing whole numbers.

46 of 71

TINYINT

An SQL data type for integers ranging from -128 to 127 inclusive.

47 of 71

SMALLINT

An SQL data type for small-range integers (i.e. integers ranging from -32,767 to 32,767 inclusive).

48 of 71

MEDIUMINT

An SQL data type for medium-range integers (i.e. integers ranging from -8388608 to 8388607 inclusive).

49 of 71

BIGINT

An SQL data type for large-range integers (i.e. integers ranging from approx. -9 to 9 quintillion).

50 of 71

Fixed-point Data Types

A numeric SQL data type with fixed decimal points.

51 of 71

DOUBLE

An SQL data type used for storing precise numeric values with floating point precision.

It can hold both very large and very small values.

52 of 71

DECIMAL

An SQL data type for fixed-point numbers.

53 of 71

DATE

An SQL data type for storing date and time as a number.

54 of 71

DATETIME

An SQL data type for storing dates only.

55 of 71

UNIX_TIMESTAMP()

An SQL data type for storing both dates and time.

56 of 71

BLOB (Binary Large Object)

An SQL data type for storing both date and time.

57 of 71

Boolean Value

A value for storing date and time as a number.

58 of 71

Constraints

A value that is either TRUE, FALSE, or NULL.

59 of 71

NOT NULL

A constraint ensuring that a column cannot have a NULL value.

60 of 71

Unique Constraint

A constraint ensuring that all values in a column are the same.

61 of 71

DEFAULT Constraint

Sets a default value for a row even when a value is specified.

62 of 71

Auto-increment

A property used in SQL to automatically generate a unique value for a column,

typically a primary key, with each new record insertion.

63 of 71

Keywords in SQL

Reserved words in SQL used to perform operations and define the structure of SQL commands.

64 of 71

Reserved Words

Words in SQL that don’t have a specific meaning and function, and can be used as identifiers like table or column names.

65 of 71

Reserved Words

Words in SQL that don’t have a specific meaning and function, and can be used as identifiers like table or column names.

66 of 71

Reserved Words

Words in SQL that have a specific meaning and function, and cannot be used as identifiers like table or column names.

67 of 71

Primary Key vs. Unique Key

68 of 71

SQL Data Types

69 of 71

Signed vs. Unsigned Values

In SQL, signed values can be positive or negative, whereas unsigned values can only be positive.

70 of 71

Keys vs. Constraint (SQL)

In the context of SQL, "keys" refer to creating relationships between separate tables or views within a database. "Constraints" refer to specifying the rules for the data in a given table.

71 of 71

Foreign Key Constraint