6.What happens if you use ALTER TABLE to add a column without specifying NOT NULL and without a default?
-
A. All existing rows will contain 0 in the new column
-
B. It causes an error
-
C. Existing rows will have NULL in that column
-
D. The column is not added
Existing rows will have NULL in that column
Existing rows will have NULL in that column
7.Which command will rename a table in SQL?
-
A. RENAME TABLE old_name TO new_name;
-
B. ALTER TABLE old_name RENAME TO new_name;
-
C. MODIFY TABLE name new_name;
-
D. UPDATE TABLE old_name TO new_name;
ALTER TABLE old_name RENAME TO new_name;
ALTER TABLE old_name RENAME TO new_name;
8.What does this command do?
ALTER TABLE employees ADD hire_date DATE;
-
A. Adds a row to the employees table
-
B. Modifies the hire_date column
-
C. Adds a new column named hire_date of type DATE
-
D. Deletes the hire_date column
Adds a new column named hire_date of type DATE
Adds a new column named hire_date of type DATE
9.Which of the following operations can be performed using the ALTER statement?
-
A. Add a constraint
-
B. Drop a column
-
C. Rename a column
-
D. All of the above
All of the above
All of the above
10.What is the correct syntax in SQL Server to add a new column with a default value?
-
A. ALTER TABLE table_name ADD column_name data_type DEFAULT value;
-
B. ADD COLUMN column_name SET DEFAULT value;
-
C. ALTER TABLE ADD DEFAULT column_name value;
-
D. ALTER COLUMN column_name DEFAULT value;
ALTER TABLE table_name ADD column_name data_type DEFAULT value;
ALTER TABLE table_name ADD column_name data_type DEFAULT value;