MySQL Database Quiz Questions

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

In MySQL, the UPDATE statement is used to modify existing records in a table.

Q2
True / False

The UPDATE statement in MySQL requires a SET clause to specify the columns and values to be updated.

Q3
True / False

In MySQL, you cannot update multiple columns at the same time using the UPDATE statement.

Q4
True / False

In MySQL, if you omit the WHERE clause in the UPDATE statement, it will update only the first record in the table.

Q5
True / False

The UPDATE statement in MySQL can be used with a subquery to set a column value.

Q6
True / False

In MySQL, the UPDATE statement can be used to modify records in multiple tables at once.

Q7
True / False

In MySQL, you can use the LIMIT clause in the UPDATE statement to restrict the number of rows that are updated.

Q8
True / False

The UPDATE statement in MySQL can use the ORDER BY clause to update rows in a specific order.

Q9
True / False

In MySQL, you cannot use a JOIN clause in the UPDATE statement.

Q10
True / False

In MySQL, it is possible to roll back an UPDATE statement if it is part of a transaction and the transaction is not yet committed.

Q11
Single Choice

What is the primary purpose of the UPDATE statement in MySQL?

Q12
Single Choice

Which clause is used in MySQL to specify which records should be updated in an UPDATE statement

Q13
Single Choice

What will happen if you omit the WHERE clause in an UPDATE statement in MySQL?

Q14
Single Choice

How can you update multiple columns in a single UPDATE statement in MySQL?

Q15
Single Choice

MySQL, which keyword can be used in conjunction with the UPDATE statement to update data based on a join with another table?

Q16
Single Choice

Which of the following MySQL functions can be used to ensure an UPDATE statement affects rows with non-null values?

Q17
Single Choice

What is the purpose of the LIMIT clause in a MySQL UPDATE statement?

Q18
Single Choice

How would you write a MySQL UPDATE statement to increment a numeric column by 1?

Q19
Single Choice

MySQL, how can you use subqueries in an UPDATE statement?

Q20
Single Choice

MySQL, which clause allows you to update rows in one table based on conditions in another table?

Q21
Multiple Choice

Identify the correct SQL statement to update a single column in a specific row.

SQL Code
UPDATE employees
SET salary = 60000
WHERE employee_id = 101;
Q22
Multiple Choice

Choose the correct SQL statement to update multiple columns in a specific row.

SQL Code
UPDATE products
SET price = 19.99, stock_quantity = 50
WHERE product_id = 10;
Q23
Multiple Choice

Determine the correct SQL statement to update all rows in a table without using a WHERE clause.

SQL Code
UPDATE orders
SET status = 'Shipped';
Q24
Multiple Choice

Which SQL statement correctly updates a column based on a condition involving another column?

SQL Code
UPDATE sales
SET discount = price * 0.1
WHERE price > 100;
Q25
Multiple Choice

Select the correct SQL statement to update multiple rows with different conditions.

SQL Code
UPDATE employees
SET department = 'HR'
WHERE employee_id = 101;
UPDATE employees
SET department = 'Finance'
WHERE employee_id = 102;
Q26
Multiple Choice

Identify the correct SQL statement to update a table using data from another table.

SQL Code
UPDATE employees e
JOIN departments d ON e.department_id = d.department_id
SET e.department_name = d.department_name
WHERE d.location = 'New York';
Q27
Multiple Choice

Which SQL statement correctly updates a column and returns the number of affected rows?

SQL Code
UPDATE customers
SET loyalty_points = loyalty_points + 10
WHERE last_order_date > '2024-01-01';
SELECT ROW_COUNT();
Q28
Multiple Choice

Determine the correct SQL statement to update a column conditionally, setting it to NULL if a condition is met.

SQL Code
UPDATE orders
SET shipped_date = NULL
WHERE status = 'Pending';
Q29
Multiple Choice

Select the correct SQL statement to increment a numeric column's value in all rows.

SQL Code
UPDATE inventory
SET stock_quantity = stock_quantity + 5;
Q30
Multiple Choice

Identify the correct SQL statement to update a table and set multiple columns using a CASE statement.

SQL Code
UPDATE products
SET price = CASE
WHEN category = 'Electronics' THEN price * 1.1
WHEN category = 'Clothing' THEN price * 1.05
ELSE price
END;