SQL Update
1.What is the main purpose of the UPDATE statement in SQL?
-
A. To remove data
-
B. To modify existing data
-
C. To create a new table
-
D. To merge tables
To modify existing data
To modify existing data
2.What will happen if you use UPDATE without a WHERE clause?
-
A. Only first row gets updated
-
B. No row gets updated
-
C. Only last row gets updated
-
D. All rows get updated
All rows get updated
All rows get updated
3.Which is the correct syntax for updating a single column?
-
A. UPDATE table SET column = value WHERE condition;
-
B. MODIFY table column TO value;
-
C. ALTER table UPDATE column = value;
-
D. SET column = value IN table;
UPDATE table SET column = value WHERE condition;
UPDATE table SET column = value WHERE condition;
4.Can we update multiple columns in a single UPDATE query?
-
A. No
-
B. Yes, using commas between assignments
-
C. Only with joins
-
D. Only in PostgreSQL
Yes, using commas between assignments
Yes, using commas between assignments
5.Which of the following is required for UPDATE to work?
-
A. Column constraints
-
B. Primary key
-
C. Table name and SET clause
-
D. ORDER BY clause
Table name and SET clause
Table name and SET clause