Multiple choice technology databases

Which of the following can NOT be done using the ALTER TABLE statement?

  1. Add a new column

  2. Drop a check constraint

  3. Change a column's name

  4. Change the length of a VARCHAR column

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In DB2, renaming a column must be done using the RENAME COLUMN statement rather than ALTER TABLE. Conversely, adding new columns, dropping check constraints, and changing VARCHAR length are standard operations that are supported directly via the ALTER TABLE statement.

AI explanation

To answer this question, you need to understand the capabilities of the ALTER TABLE statement in SQL. Let's go through each option to understand why it is correct or incorrect:

Option A) Add a new column - This option is correct because the ALTER TABLE statement can be used to add a new column to an existing table.

Option B) Drop a check constraint - This option is correct because the ALTER TABLE statement can be used to drop or remove a check constraint from a table.

Option C) Change a column's name - This option is incorrect because the ALTER TABLE statement can be used to change a column's name in SQL. Therefore, it can be done using the ALTER TABLE statement.

Option D) Change the length of a VARCHAR column - This option is correct because the ALTER TABLE statement can be used to modify the length of a VARCHAR column in SQL.

The correct answer is C. Changing a column's name can be done using the ALTER TABLE statement.