This set of SQL Multiple Choice Questions & Answers (MCQs) focuses on “SQL Update Statement”.
1. Which clause is used in an update statement to modify only specific records of a table?
a) Modify
b) Where
c) Specific
d) Set
View Answer
Explanation: To modify the existing records of a table, UPDATE statement is used. Using UPDATE one or more records can be modified at a time. Where clause is used to update only specific records.
2. Which of the following provides a correct syntax for UPDATE statement?
a) Update table_name Set column1=value1, column2=value2, … Where condition(s);
b) Update table_name Modify column1=value1, column2=value2, … Where condition(s);
c) Update table_name Alter column1=value1, column2=value2, … Where condition(s);
d) Update table_name Values column1=value1, column2=value2, … Where condition(s);
View Answer
Explanation: SET is used along with UPDATE in an Update statement to assign the values for respective fields. Where clause can also be used with update statement to modify only specific records.
3. To update all the records of a table, which of the following clause is omitted from an UPDATE statement?
a) Update
b) Set
c) Where
d) Values
View Answer
Explanation: Set and Update clause are mandatory for an UPDATE statement. Where clause is optional. If only specific records of a table are to be modified, where clause is used. Otherwise, it is omitted from an UPDATE statement.
4. SET keyword in an UPDATE statement is used to ______
a) Modify records in a database
b) Modify a particular record in a database
c) Set new values to the particular column
d) Set new values to all the columns of a table
View Answer
Explanation: Update statement is used to modify records in a database. Set keyword is used to set new values to the particular column(s) of the table.
5. Using UPDATE statement, multiple tables can be updated at a time.
a) True
b) False
View Answer
Explanation: Using Update only a single statement can be updated at a time. To update n number of tables Update statement has to be written n number of times.
6. How many columns can be modified using a single UPDATE statement?
a) One column
b) One to five columns
c) One to ten columns
d) Any number of columns
View Answer
Explanation: Using UPDATE command any number of columns can be updated at a time. Single columns as well as multiple columns can be updated using UPDATE statement as per our requirement.
7. Which of the following clause is used with SQL UPDATE statement when updating a table with data from another table?
a) Select
b) Where
c) Copy
d) From
View Answer
Explanation: Select clause is used to update a table with data from another table. Syntax for such statement is:
UPDATE TABLE_NAME SET column_list = (SELECT statement) WHERE condition;
8. UPDATE is a _________ command.
a) Data definition language
b) Data manipulation language
c) Data control language
d) Transaction control language
View Answer
Explanation: Statements used for managing data within schema objects comes under DML commands. DELETE is a DML command.
Sanfoundry Global Education & Learning Series – SQL.
To practice all areas of SQL, here is complete set of 1000+ Multiple Choice Questions and Answers.