Multiple choice

We can modify the data type of a column which already has data only _____.

  1. when the data type of the column is varchar

  2. when the column is empty

  3. Anytime we want, there are no restrictions

  4. If we are logged in as SYSTEM

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

To modify a column that already has data in it, it is compulsory to first empty the whole column. When all the values of the column are emptied we can modify the datatype of the column. To empty a column, we can use the following SQL statement.Update tablename set columnname=nullFor example, to empty all the values of the column address of the table customer the statement will beupdate customer set address = nullTo modify the datatype of the column we can use the following SQL Statementalter table customer modify(address varchar(10))