0
0
MySQLquery~5 mins

INSERT with SELECT in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the INSERT with SELECT statement do in SQL?
It copies data from one table and inserts it into another table using a SELECT query inside the INSERT statement.
Click to reveal answer
beginner
Write the basic syntax of INSERT with SELECT.
INSERT INTO target_table (column1, column2) SELECT column1, column2 FROM source_table WHERE condition;
Click to reveal answer
beginner
Can you use INSERT with SELECT to insert multiple rows at once?
Yes, the SELECT can return many rows, and all will be inserted into the target table in one statement.
Click to reveal answer
intermediate
What must match between the INSERT columns and the SELECT columns?
The number and order of columns in the INSERT clause must match the columns selected in the SELECT clause.
Click to reveal answer
intermediate
Why might you use INSERT with SELECT instead of multiple INSERT statements?
It is faster and simpler to copy many rows at once from one table to another without writing many separate INSERT commands.
Click to reveal answer
What does the INSERT with SELECT statement do?
ADeletes data from a table
BCreates a new table
CUpdates data in a table
DCopies data from one table to another using a SELECT query
Which must be true for the columns in INSERT with SELECT?
AThe SELECT can have more columns than INSERT
BThe number and order of columns must match
CThe columns can be in any order
DThe INSERT can have more columns than SELECT
Can INSERT with SELECT insert multiple rows at once?
AOnly if the table is empty
BNo, it inserts only one row
CYes, it inserts all rows returned by SELECT
DOnly if you use a loop
Which SQL keyword is used inside INSERT with SELECT to get data?
ASELECT
BUPDATE
CDELETE
DCREATE
Why use INSERT with SELECT instead of many single INSERTs?
AIt is faster and simpler for many rows
BIt deletes old data automatically
CIt creates indexes
DIt changes table structure
Explain how the INSERT with SELECT statement works and when you might use it.
Think about copying data between tables without typing many INSERT commands.
You got /4 concepts.
    Describe the rules for matching columns in INSERT with SELECT.
    Imagine matching puzzle pieces for columns.
    You got /3 concepts.