MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the queries below can be used to alter the DataFlair table such that we can add a new gender column to our table?
A
ALTER TABLE DataFlair ADD gender varchar;
B
ALTER TABLE DataFlair gender varchar(10);
C
ALTER DataFlair ADD gender varchar;
D
ALTER TABLE DataFlair ADD gender varchar(10);
Explanation: 

Detailed explanation-1: -The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used to add and drop various constraints on an existing table.

Detailed explanation-2: -We can use ALTER TABLE ALTER COLUMN statement to change the datatype of the column. The syntax to change the datatype of the column is the following. In the syntax, Tbl name: Specify the table name that contains the column that you want to change.

Detailed explanation-3: -The basic syntax of an ALTER TABLE command to change the DATA TYPE of a column in a table is as follows. ALTER TABLE table name MODIFY COLUMN column name datatype; The basic syntax of an ALTER TABLE command to add a NOT NULL constraint to a column in a table is as follows.

Detailed explanation-4: -The ALTER COLUMN command is used to change the data type of a column in a table.

There is 1 question to complete.