Skip to main contentSkip to solution

Which of the following are correct syntax in SQL?

(A) UPDATE tablename SET attribute1=value1, attribute2=value2.......WHERE condition;

(B) UPDATE TABLE tablename SET attribute1=value1, attribute2=value2.......WHERE condition;

(C) ALTER tablename DROP attribute;

(D) ALTER TABLE tablename DROP attribute;

Solution

✅ Correct Option: 1

The correct syntax for UPDATE is UPDATE tablename SET column = value, ... WHERE condition;\text{UPDATE tablename SET column = value, ... WHERE condition;} with no TABLE keyword, so (A) is correct.

The correct syntax for removing a column is ALTER TABLE tablename DROP COLUMN column;\text{ALTER TABLE tablename DROP COLUMN column;}. The ALTER TABLE keywords are required, so (D) is the valid statement among the given forms (the COLUMN keyword is optional in some systems such as MySQL).


(B): UPDATE is never followed by the keyword TABLE.

(C): ALTER must be followed by TABLE, so "ALTER tablename" is invalid.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question