Recall & Review
beginner
What is a column definition in a database table?
A column definition specifies the name, data type, and optional settings for a column in a table. It tells the database what kind of data the column will hold.
Click to reveal answer
beginner
What does the NOT NULL constraint do?
The NOT NULL constraint ensures that a column cannot have empty (NULL) values. Every row must have a value in that column.
Click to reveal answer
intermediate
Explain the PRIMARY KEY constraint.
PRIMARY KEY uniquely identifies each row in a table. It means the column(s) must have unique values and cannot be NULL.
Click to reveal answer
intermediate
What is the purpose of the UNIQUE constraint?
The UNIQUE constraint makes sure all values in a column are different from each other, but unlike PRIMARY KEY, it can allow NULL values.
Click to reveal answer
beginner
How does the DEFAULT value work in column definitions?
DEFAULT sets a value automatically for a column when no value is provided during data insertion.
Click to reveal answer
Which constraint prevents a column from having empty values?
✗ Incorrect
NOT NULL ensures that a column must always have a value and cannot be left empty.
What does the PRIMARY KEY constraint guarantee?
✗ Incorrect
PRIMARY KEY ensures each row is uniquely identified with no NULL values.
Which constraint allows multiple NULL values but no duplicate non-NULL values?
✗ Incorrect
UNIQUE allows NULLs but ensures all non-NULL values are unique.
What happens if you insert a row without specifying a value for a column with a DEFAULT constraint?
✗ Incorrect
DEFAULT provides a preset value when no value is given during insertion.
Which data type would you use to store a person's age in a column definition?
✗ Incorrect
INT is used for whole numbers like age.
Describe the main types of constraints you can apply to columns in a MySQL table and their purposes.
Think about how constraints control data validity and uniqueness.
You got /5 concepts.
Explain how you would define a column for storing email addresses that must be unique and never empty.
Combine data type and constraints to enforce rules.
You got /4 concepts.