MySQL Database Quiz Questions

Course Name:MySQL
Chapter Name:Chapter 6 - DML (Data Manipulation Language)
Lesson Content Link:INSERT
Current Quiz Count:30
Progress
0%
Q1
True / False

The MySQL "INSERT" statement can be used to add new rows to a table.

Q2
True / False

In MySQL, the "INSERT" statement can insert multiple rows into a table with a single command.

Q3
True / False

The "INSERT" statement in MySQL requires all column names to be specified.

Q4
True / False

The MySQL "INSERT IGNORE" statement inserts a new row but ignores errors for duplicate key violations.

Q5
True / False

The "INSERT INTO ... SELECT" statement in MySQL can copy data from one table to another.

Q6
True / False

In MySQL, you cannot use subqueries within an "INSERT" statement.

Q7
True / False

The "INSERT ON DUPLICATE KEY UPDATE" statement in MySQL updates existing rows when a duplicate key is found.

Q8
True / False

MySQL allows inserting data into a view using an "INSERT" statement.

Q9
True / False

The "INSERT" statement in MySQL can be used with stored procedures.

Q10
True / False

The MySQL "INSERT DELAYED" statement improves performance by delaying the insert operation until the table is free.

Q11
Single Choice

Which of the following is the correct syntax to insert a new row into a MySQL table?

Q12
Single Choice

Which MySQL keyword is used to insert data into a table?

Q13
Single Choice

If you want to insert data into only specific columns of a table, which part of the MySQL INSERT statement is optional?

Q14
Single Choice

What will happen if you try to insert a duplicate value into a MySQL table's primary key column?

Q15
Single Choice

How can you insert multiple rows into a MySQL table with a single INSERT statement?

Q16
Single Choice

Which MySQL clause can be used with the INSERT statement to update existing records instead of inserting new ones if a duplicate key is found?

Q17
Single Choice

Which MySQL statement can be used to insert data from one table into another table?

Q18
Single Choice

How do you insert data into a MySQL table and return the last inserted ID?

Q19
Single Choice

Which MySQL statement allows you to insert data and ignore errors related to duplicate keys?

Q20
Single Choice

What is the purpose of the REPLACE INTO statement in MySQL, and how does it differ from the INSERT statement?

Q21
Multiple Choice

Identify the correct SQL statement to insert a new row into a table with all columns specified.

SQL Code
INSERT INTO employees (employee_id, first_name, last_name, department)
VALUES (1, 'John', 'Doe', 'HR');
Q22
Multiple Choice

Choose the correct SQL statement to insert a new row with only specific columns specified.

SQL Code
INSERT INTO products (product_name, price)
VALUES ('Laptop', 1500);
Q23
Multiple Choice

Determine the correct SQL statement to insert multiple rows into a table in a single query.

SQL Code
INSERT INTO orders (order_id, customer_id, order_date)
VALUES (1, 101, '2024-01-01'),
(2, 102, '2024-01-02');
Q24
Multiple Choice

Which SQL statement correctly uses INSERT IGNORE to avoid inserting a row if a duplicate key exists?

SQL Code
INSERT IGNORE INTO users (user_id, username, email)
VALUES (1, 'jdoe', 'jdoe@example.com');
Q25
Multiple Choice

Select the correct SQL statement to insert data into a table using a SELECT statement.

SQL Code
INSERT INTO archive_orders (order_id, customer_id, order_date)
SELECT order_id, customer_id, order_date
FROM orders
WHERE order_date < '2023-01-01';
Q26
Multiple Choice

Determine the correct SQL statement to insert a row and return the AUTO_INCREMENT value of the inserted row.

SQL Code
INSERT INTO transactions (amount, transaction_date)
VALUES (100, '2024-01-01');
SELECT LAST_INSERT_ID();
Q27
Multiple Choice

Which SQL statement correctly inserts data into a table with a BLOB column?

SQL Code
INSERT INTO images (image_id, image_data)
VALUES (1, LOAD_FILE('/path/to/image.jpg'));
Q28
Multiple Choice

Select the correct SQL statement to insert data into a table with a TIMESTAMP column that uses the current time as a default.

SQL Code
INSERT INTO log_entries (log_id, log_message)
VALUES (NULL, 'System rebooted');
Q29
Multiple Choice

Determine the correct SQL statement to insert a row using default values for unspecified columns.

SQL Code
INSERT INTO employees (employee_name)
VALUES ('Jane Smith');
Q30
Multiple Choice

Identify the correct SQL statement to insert data into a table with a generated column.

SQL Code
INSERT INTO orders (product_id, quantity)
VALUES (101, 2);