Recall & Review
beginner
What does AUTO_INCREMENT do in SQL?
AUTO_INCREMENT automatically generates a unique number for a column when a new row is inserted, usually used for primary keys.
Click to reveal answer
beginner
What is SERIAL in SQL?
SERIAL is a shorthand in PostgreSQL that creates an integer column and automatically sets up a sequence to generate unique numbers for new rows.
Click to reveal answer
beginner
What is IDENTITY in SQL?
IDENTITY is a SQL standard feature that defines a column to auto-generate unique numbers, often used in SQL Server and newer versions of other databases.
Click to reveal answer
intermediate
How does AUTO_INCREMENT differ from SERIAL?
AUTO_INCREMENT is used mainly in MySQL and automatically increments a number, while SERIAL in PostgreSQL creates a sequence object behind the scenes to generate numbers.
Click to reveal answer
intermediate
Why might you choose IDENTITY over AUTO_INCREMENT or SERIAL?
IDENTITY follows the SQL standard and offers more control over number generation, making it more portable across different database systems.
Click to reveal answer
Which SQL feature automatically creates a sequence object in PostgreSQL?
✗ Incorrect
SERIAL in PostgreSQL creates a sequence object to generate unique numbers automatically.
In which database is AUTO_INCREMENT commonly used?
✗ Incorrect
AUTO_INCREMENT is commonly used in MySQL to auto-generate unique numbers.
What does the IDENTITY property do in SQL?
✗ Incorrect
IDENTITY defines a column to auto-generate unique numbers, often for primary keys.
Which of these is a SQL standard feature for auto-numbering?
✗ Incorrect
IDENTITY is part of the SQL standard for auto-generating unique numbers.
Which feature is NOT typically used for auto-incrementing primary keys?
✗ Incorrect
VARCHAR is a text data type and does not auto-increment numbers.
Explain the differences between AUTO_INCREMENT, SERIAL, and IDENTITY in SQL.
Think about which database uses which feature and how they generate numbers.
You got /4 concepts.
Why is IDENTITY considered more portable than AUTO_INCREMENT or SERIAL?
Consider standards and cross-database compatibility.
You got /3 concepts.