0
0
MySQLquery~10 mins

INSERT with SELECT in MySQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to insert all rows from old_table into new_table.

MySQL
INSERT INTO new_table SELECT * FROM [1];
Drag options to blanks, or click blank then click option'
Abackup_table
Bold_table
Ctemp_table
Dnew_table
Attempts:
3 left
💡 Hint
Common Mistakes
Using the target table name after FROM instead of the source table.
Confusing the order of tables in the statement.
2fill in blank
medium

Complete the code to insert only the id and name columns from employees into staff.

MySQL
INSERT INTO staff (id, name) SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
Aid, salary
Bname, salary
Cid, name
Did, department
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting columns not listed in the INSERT clause.
Mixing up column order between INSERT and SELECT.
3fill in blank
hard

Fix the error in the code to insert data from orders into archive_orders where status is 'completed'.

MySQL
INSERT INTO archive_orders SELECT * FROM orders WHERE status [1] 'completed';
Drag options to blanks, or click blank then click option'
A=
B==
CLIKE
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using == instead of =.
Using LIKE without wildcards.
4fill in blank
hard

Fill both blanks to insert product_id and quantity from sales where quantity is greater than 10.

MySQL
INSERT INTO big_sales (product_id, quantity) SELECT product_id, quantity FROM sales WHERE quantity [1] [2];
Drag options to blanks, or click blank then click option'
A>
B<
C10
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of >.
Using wrong number in the condition.
5fill in blank
hard

Fill all three blanks to insert uppercase category and price from products where price is less than 100.

MySQL
INSERT INTO cheap_products (category, price) SELECT [1], [2] FROM products WHERE price [3] 100;
Drag options to blanks, or click blank then click option'
AUPPER(category)
Bprice
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Not using UPPER() for category.
Using > instead of < for price condition.