0
0
MySQLquery~5 mins

INSERT INTO multiple rows in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the SQL statement INSERT INTO do?
It adds new rows of data into a table in the database.
Click to reveal answer
beginner
How do you insert multiple rows in one SQL statement?
Use INSERT INTO table_name (columns) VALUES (row1), (row2), (row3); listing each row's values separated by commas.
Click to reveal answer
intermediate
Why insert multiple rows at once instead of one by one?
It is faster and uses fewer resources because the database processes one command instead of many.
Click to reveal answer
beginner
Write a simple example to insert two rows into a table named students with columns id and name.
INSERT INTO students (id, name) VALUES (1, 'Alice'), (2, 'Bob');
Click to reveal answer
intermediate
What happens if you try to insert rows with duplicate primary keys?
The database will return an error and will not insert any of the rows.
Click to reveal answer
Which SQL keyword is used to add new rows to a table?
AINSERT INTO
BSELECT
CUPDATE
DDELETE
How do you separate multiple rows in an INSERT INTO statement?
AWith commas (,)
BWith semicolons (;)
CWith periods (.)
DWith colons (:)
What is the benefit of inserting multiple rows in one statement?
AIt slows down the database
BIt is faster and more efficient
CIt uses more memory
DIt deletes old data
Which of these is a correct syntax to insert two rows into a table named users?
AINSERT INTO users VALUES (1, 'John'); INSERT INTO users VALUES (2, 'Jane');
BINSERT INTO users (id, name) VALUES (1, 'John' AND 2, 'Jane');
CINSERT INTO users (id, name) VALUES (1, 'John'), (2, 'Jane');
DINSERT INTO users (id, name) VALUES (1, 'John'); (2, 'Jane');
What error occurs if you insert rows with duplicate primary keys?
AConnection error
BSyntax error
CNo error, rows are updated
DDuplicate key error
Explain how to insert multiple rows into a MySQL table in one statement.
Think about how you add items to a shopping list separated by commas.
You got /4 concepts.
    Describe why inserting multiple rows at once is better than inserting one row at a time.
    Imagine carrying many groceries in one trip instead of many trips.
    You got /4 concepts.