Recall & Review
beginner
What does the SQL command
INSERT INTO do?It adds a new row of data into a table in the database.
Click to reveal answer
beginner
Write the basic syntax to insert a single row into a table named
students with columns id and name.INSERT INTO students (id, name) VALUES (1, 'Alice');
Click to reveal answer
intermediate
Can you insert a row without specifying column names in SQL?
Yes, if you provide values for all columns in the exact order they appear in the table.
Click to reveal answer
intermediate
What happens if you try to insert a row with a duplicate primary key?
The database will reject the insert and return an error because primary keys must be unique.
Click to reveal answer
beginner
Why is it a good practice to specify column names in an
INSERT INTO statement?It makes the query clearer and safer, especially if the table structure changes later.
Click to reveal answer
Which SQL keyword is used to add a new row to a table?
✗ Incorrect
The
INSERT INTO statement adds new rows to a table.What must you include in an
INSERT INTO statement to add a single row?✗ Incorrect
You need to specify the table name and the values to insert.
If a table has columns
id, name, and age, which is a correct insert statement?✗ Incorrect
Option B correctly specifies columns and matching values.
What error occurs if you insert a row with a duplicate primary key?
✗ Incorrect
Primary keys must be unique; duplicates cause a unique constraint violation.
Is it mandatory to specify column names in an
INSERT INTO statement?✗ Incorrect
You can omit column names if you provide values for all columns in the correct order.
Explain how to insert a single row into a SQL table and why specifying column names is helpful.
Think about the syntax and benefits of naming columns.
You got /3 concepts.
What happens if you try to insert a row with a duplicate primary key? How can you avoid this?
Consider the role of primary keys in uniqueness.
You got /4 concepts.