Update Statements

Update Statements

12th Grade

21 Qs

quiz-placeholder

Similar activities

SQL

SQL

11th - 12th Grade

20 Qs

SQL Queries

SQL Queries

12th Grade

25 Qs

CLASS XI - MYSQL QUIZ

CLASS XI - MYSQL QUIZ

11th - 12th Grade

20 Qs

Database Quiz 4 SQL

Database Quiz 4 SQL

12th Grade

21 Qs

JAVASCRIPT

JAVASCRIPT

12th Grade

25 Qs

2ND QTR-QUIZ 4-JDBC Prepared Statements-12-1-2022

2ND QTR-QUIZ 4-JDBC Prepared Statements-12-1-2022

12th Grade

25 Qs

Examen de Programación III

Examen de Programación III

12th Grade

20 Qs

GCSE Computer Science Data types

GCSE Computer Science Data types

10th - 12th Grade

18 Qs

Update Statements

Update Statements

Assessment

Quiz

Computers

12th Grade

Medium

Created by

David Copeland

Used 1+ times

FREE Resource

21 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write an UPDATE statement to change the salary of an employee with employee_id 101 to 60000.
UPDATE employees SET salary = 60000 WHERE employee_id = 101;
UPDATE employees SET salary = 60000;
UPDATE employees SET salary = 60000 WHERE employee_id = '101';
UPDATE employees SET salary = 60000 WHERE employee_id = 100;

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you update multiple columns in a single UPDATE statement?
UPDATE table_name SET column1 = value1 SET column2 = value2 WHERE condition;
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
UPDATE table_name SET column1 = value1 AND column2 = value2 WHERE condition;
UPDATE table_name SET column1 = value1, column2 = value2;

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write an UPDATE statement to set the status to 'inactive' for all users who haven't logged in for over a year.
UPDATE users SET status = 'inactive' WHERE last_login < DATE_SUB(NOW(), INTERVAL 1 YEAR);
UPDATE users SET status = 'inactive' WHERE last_login < DATE_SUB(NOW(), INTERVAL 1 MONTH);
UPDATE users SET status = 'inactive' WHERE last_login < DATE_SUB(NOW(), INTERVAL 1 DAY);
UPDATE users SET status = 'inactive' WHERE last_login < DATE_SUB(NOW(), INTERVAL 1 HOUR);

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How would you update a column based on a calculation involving another column? For example, increasing price by 10%.
UPDATE products SET price = price + 10;
UPDATE products SET price = price * 1.10;
UPDATE products SET price = price / 1.10;
UPDATE products SET price = price - 10;

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write an UPDATE statement to change the department of employees with department_id 5 to 'Sales'.
UPDATE employees SET department = 'Sales' WHERE department_id = 5;
UPDATE employees SET department = 'Sales';
UPDATE employees SET department = 'Sales' WHERE department_id = 6;
UPDATE employees SET department = 'Sales' WHERE department_id = '5';

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Why is it important to use the primary key in an UPDATE statement?
It ensures that the UPDATE statement targets a specific, unique row.
It allows updating multiple rows at once.
It improves the readability of the SQL code.
It prevents the need for a WHERE clause.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What could happen if you omit the WHERE clause in an UPDATE statement?
Only the first row will be updated.
All rows in the table will be updated.
No rows will be updated.
An error will be thrown.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?