Recall & Review
beginner
What does AUTO_INCREMENT do in a SQL table?
AUTO_INCREMENT automatically generates a unique number for a column when a new row is added, usually used for primary keys.
Click to reveal answer
intermediate
Can you insert a specific value into an AUTO_INCREMENT column?
Yes, you can insert a specific value manually, but it must not conflict with existing values to avoid errors.
Click to reveal answer
intermediate
What happens if you delete the last row with the highest AUTO_INCREMENT value?
The AUTO_INCREMENT counter does not decrease automatically; new rows continue from the last highest value plus one.
Click to reveal answer
advanced
How can you reset the AUTO_INCREMENT counter in MySQL?
You can reset it using: ALTER TABLE table_name AUTO_INCREMENT = value; where value is the new starting number.
Click to reveal answer
beginner
Why is AUTO_INCREMENT useful in real-life applications?
It helps create unique IDs automatically, like customer IDs or order numbers, so you don’t have to manage them manually.
Click to reveal answer
What type of column usually uses AUTO_INCREMENT?
✗ Incorrect
AUTO_INCREMENT is typically used for primary key columns to generate unique IDs automatically.
If you insert a row without specifying the AUTO_INCREMENT column, what happens?
✗ Incorrect
When you omit the AUTO_INCREMENT column in an insert, the database assigns the next unique number automatically.
After deleting rows, what happens to the AUTO_INCREMENT counter?
✗ Incorrect
Deleting rows does not reset the AUTO_INCREMENT counter; it keeps increasing from the last highest value.
How do you manually reset the AUTO_INCREMENT value in MySQL?
✗ Incorrect
The correct syntax to reset AUTO_INCREMENT in MySQL is using ALTER TABLE with AUTO_INCREMENT = new_value.
What happens if you try to insert a duplicate value into an AUTO_INCREMENT column?
✗ Incorrect
Inserting a duplicate value into an AUTO_INCREMENT column causes an error because the column must be unique.
Explain how AUTO_INCREMENT works when adding new rows to a table.
Think about how IDs are assigned automatically without you typing them.
You got /4 concepts.
Describe how to reset the AUTO_INCREMENT counter and why you might want to do that.
Consider when you want your IDs to start fresh or from a specific number.
You got /3 concepts.