Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
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.
✗ Incorrect
The
INSERT INTO ... SELECT statement copies rows from the source table (old_table) into the target table (new_table).2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting columns not listed in the INSERT clause.
Mixing up column order between INSERT and SELECT.
✗ Incorrect
You must select the same columns in the same order as the columns listed in the INSERT statement.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
== instead of =.Using
LIKE without wildcards.✗ Incorrect
In SQL, the equality operator is a single equals sign
=, not double equals.4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of >.
Using wrong number in the condition.
✗ Incorrect
The condition must check if quantity is greater than 10, so use > 10.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using UPPER() for category.
Using > instead of < for price condition.
✗ Incorrect
Use
UPPER(category) to convert category to uppercase, select price as is, and filter where price is less than 100.