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

How do I write a sql query in pgadmin 4?

0 Answers  


How subquery works in sql?

0 Answers  


what are date and time functions in mysql? : Sql dba

0 Answers  


What are the types of views in sql?

0 Answers  


What are actual parameters and formal parameters?

0 Answers  






how to analyze tables with 'mysqlcheck'? : Sql dba

0 Answers  


what is the difference between ereg_replace() and eregi_replace()? : Sql dba

0 Answers  


Dear All, Question for this Week Find out possible error(s) (either at compile time or at runtime) in the following PL/SQL block. State the reason(s) and correct the errors. Declare Cursor C1 is select ename, sal, comm from emp; Begin For i in C1 Loop If i.comm between 299 and 999 then Dbms_output.put_line(i.Ename || ‘ ** Good Commission’); Elsif i.comm > 999 then Dbms_output.put_line(i.Empno || ‘ ** Very Good Commission’); close C1; Else Dbms_output.put_line(i.Ename || ‘ ** ’ ||nvl(i.comm,‘O’)); End if; End Loop; End;

7 Answers   Accenture,


Can we relate two different tables from two different users in ORACLE,PL/SQL?

4 Answers  


Can we join more than 2 tables in sql?

0 Answers  


What is join view in sql?

0 Answers  


Can you do multiple joins in sql?

0 Answers  


Categories