If we have n no of columns in a table, can we add new
column in that table with not null constraint?

Answers were Sorted based on User's Feedback



If we have n no of columns in a table, can we add new column in that table with not null constrain..

Answer / srinu

U r correct Chandan.But one thing,what is that is if the
table contains some data at that time syntax for adding new
column to that table with notnull constraint is....

alter table table_name add column_name datatype default
value constraint constraint_name not null;

if we want 2 know which columns have which constraints then
the syntax is

select column_name,constraint_type
from user_cons_columns
where table_name='EMP';

Is This Answer Correct ?    7 Yes 1 No

If we have n no of columns in a table, can we add new column in that table with not null constrain..

Answer / chandan kumar

If table is empty (means no records are there) then we can
add the constraint.

alter table tablename add (col_name datatype not null)

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

Explain foreign key in sql?

0 Answers  


I want to create synonym for table emp but in my pc it is giving insufficient previliges.I am using user scott.Please suggest me.

3 Answers  


How does postgresql compare to mysql?

0 Answers  


can i give user defined exception in a package

2 Answers  


What are the parameter modes supported by pl/sql?

0 Answers  


How do you add a column to a table?

0 Answers  


Are ddl triggers fired for ddl statements within a pl/sql code executed using the dbms.sql package?

0 Answers  


Is progress software supports to ( pl/sql )?

0 Answers  


What is rownum in sql?

0 Answers  


What is compound trigger?

0 Answers  


can we use out parameter in a function?Give an example.

4 Answers   Logica CMG, TCS,


how to retrieve the top 2 salaried persons from a database?

7 Answers   Orion Laboratories,


Categories