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

Delete the emps whose salaries are lowest sals of their own dept.

5 Answers  


Is oracel sql developer written in java?

0 Answers  


What is the difference between alter trigger and drop trigger statements?

0 Answers  


What are tables and fields?

0 Answers  


How do I count duplicates in sql?

0 Answers  






Can a composite key be null?

0 Answers  


i have a customer table. trans_id trans_date trans_amt debit_credit_indicator 001 01-JAN-13 1099 cr 001 12-JAN-13 500 db 002 24-FEB-13 400 db 002 23-MAR-13 345 cr 001 18-APR-13 800 cr 002 15-MAR-13 600 db 001 12-FEB-13 200 cr i want like this output. trans_id trans_amt debit_credit_indicator i want get highest credit amount and lowest credit amount and highest debit amount and lowest debit amount for each trans_id.

2 Answers   Oracle,


Mention what plvcmt and plvrb does in pl/sql?

0 Answers  


Is delete faster than truncate?

0 Answers  


What is the need of a partition key?

0 Answers  


What do you understand by pl/sql packages?

0 Answers  


What is AUTH_ID and AUTH_USER in pl/sql ?

0 Answers   INDUS,


Categories