Which statement adds a column called salary to the employees table having 100 rows, which
cannot contain null?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Explanation:
http://www.comp.nus.edu.sg/~ooibc/courses/sql/ddl_table.htm (see changing table
structures)
I am not sure about this answer, 12c documentation in http://docs.oracle.com/database/121/SQLRF/statements_3001.htm says:
” When you add a column, the initial value of each row for the new column is null, unless you specify the DEFAULT clause. ”
So, I would say C instead of A.
Really,
the correct answer on this question is option C.
If you wanna add a new column, it should have a value default.
No, default value is not necessary for a column.
The ans is A.
If the table is empty.
However, as the table has already 100 rows of data, DEFAULT is required.
Therefore C.
Yes, C
I’m surprised but…. ONLY answer ‘C’ is correct.
Try it: Alter Table Employee add salary number(8,2) not null;
Result: ERROR at line 1: ORA-01758: table must be empty to add mandatory (NOT NULL) column
Who the fuck marked correct answer as A?!
C is the correct answer Verified.
Yes C is correct answer
C is correct answer…Tested