which cannot contain null?

Which statement adds a column called salary to the employees table having 100 rows,
which cannot contain null?

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)



Leave a Reply 4

Your email address will not be published. Required fields are marked *


Deepak

Deepak

Correct option is C.

My table test_country has 100 rows 🙂
Example A.
alter table test_country add salary Number(8,2) NOT NULL;
ORA-01758: table must be empty to add mandatory (NOT NULL) column

Example C.
alter table test_country add salary Number(8,2) Default 0 NOT NULL;
Table altered.

9jansen

9jansen

C as proven by Deepak and make more sense with the existing 100 rows of data.

nila

nila

Actually if the column is already present and need to change means we need to use modify instead of add
alter table employees
modify salary number(8,2) not null;

So none of the option is correct

Wacha Mollo

Wacha Mollo

Correct answer C

Answer A comes with this error
Error report –
ORA-01758: table must be empty to add mandatory (NOT NULL) column
01758. 00000 – “table must be empty to add mandatory (NOT NULL) column”
*Cause:
*Action: