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

Is it mandatory for the primary key to be given a value when a new record is inserted?

1 Answers  


What are the different ddl commands in sql?

1 Answers  


How would you convert date into julian date format?

1 Answers  


What is the difference between partition and index?

1 Answers  


Explain UNION,MINUS,UNION ALL, INTERSECT?

1 Answers  


what are numeric data types? : Sql dba

1 Answers  


What is a sql profiler?

1 Answers  


What is the current version of postgresql?

0 Answers  


Why do we need unique key in a table?

1 Answers  


what are the differences among rownum, rank and dense_rank? : Sql dba

1 Answers  


What is the difference between join and union.

27 Answers   3i Infotech, ABC, Oracle, Polaris, TCS, XT Global,


How does one load ebcdic data? : aql loader

1 Answers  


Categories