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
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 |
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 |
How do I write a sql query in pgadmin 4?
How subquery works in sql?
what are date and time functions in mysql? : Sql dba
What are the types of views in sql?
What are actual parameters and formal parameters?
how to analyze tables with 'mysqlcheck'? : Sql dba
what is the difference between ereg_replace() and eregi_replace()? : Sql dba
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;
Can we relate two different tables from two different users in ORACLE,PL/SQL?
Can we join more than 2 tables in sql?
What is join view in sql?
Can you do multiple joins in sql?