What is the difference between column level constraints and
table level constraints?
Answers were Sorted based on User's Feedback
Answer / nilesh
Column level constraints are applicable to that column
only, whereas table level conatraints are used to define
composite keys like primary key for the combination of two
or more columns in a table
Is This Answer Correct ? | 201 Yes | 35 No |
Answer / mohan
column level constraints contain all types of constraints
(like, not null,primary key,foregin key,unique).but table
level except not null constraint its supports all
constraints.
Is This Answer Correct ? | 125 Yes | 32 No |
Answer / gurupatham
Column Level Constraints refers Only One Column .Which does
not have the column name at declaration time .
Ex : Create table emp
( empno number primary Key,
--,
--);
Table Level constraints refers one or more than one column .
Which does have column name at declaration time.
Ex: Create table emp
( empno number ,
--,
--,
Constraints pk_con primary Key(empno));
All constraints can be created as Column and Table level
expect Not Null constraints .
Not Null constraints can only be created as column level
constraints . Does not have constraints name.
Is This Answer Correct ? | 88 Yes | 24 No |
Answer / vijay
1)Column level constraint is declared at the time of
creating a table but table level constraint is created
after table is created.
2)NOT NULL constraint can't be created at table level.
3)Composite primary key must be declared at table level.
4)All the constraints can be created at table level but for
table level NOT NULL is no allowed.
Is This Answer Correct ? | 48 Yes | 25 No |
Answer / chaitu
If constraint is defined at the column definition(refer the below exmpls) then it is known to be column level, where as table leevel constraints is defined at the especially incase of composite primary key or composite foriegn key.
Examples
----------
CREATE TABLE CLASS ( ROOM NUMBER(10) CONSTRAINT ID CHECK (ID BETWEEN 1 AND 2000),
..........
.........
........
.........);
Table level
==================
CREATE TABLE CLASS (
ROOM NUMBER(10) ,
SUBJECT VARCHAR2(200),
CODE VARCHAR2(50) NOT NULL, /* Column level constraint*/
ID NUMBER(8,2),
CLASS_DATE DATE,
CONSTRAINT PK_1 PRIMARY KEY (ROOM)); /* table level
Is This Answer Correct ? | 30 Yes | 9 No |
Answer / rajan sharma
Column level are those constraints that are inserted after
the declaration of the data typeot
Syntax :
CREATE TABLE table_name
(Column_name Datatype NOT NULL )
Example : Not null,pimary key,foreign key, unique and check.
Table level constraints are those that are inserted at the
end of the table.
Example : pimary key,foreign key, unique and check.
Thanks
Is This Answer Correct ? | 21 Yes | 4 No |
Answer / priya
Constraints define the conditions or predictions under
which data is valid.
column level constraints are applicable to single column
only like if we want to make Unique constraint on column
level then as shoen below:-
<column Name><data type>Unique
At table level
Unique(<coulmn>,<column>);
Table level constraints means when constraints apply on
more than single column.
Is This Answer Correct ? | 22 Yes | 6 No |
Answer / pcsenthil
we can achive all type of constraint in both level but we
cannot use NOT NULL in table Level, the reason was "All
Constraint will give logical view to that particular column
but NOT NULL will assign to the structure of the table
itself.. that's why we can see NOT NULL constraint while
Describe the table, no other constraint will be seen.
Is This Answer Correct ? | 17 Yes | 5 No |
Answer / adinarayana
COLUMN LEVEL
1.Column level constraints can be defined along with the
columns.
2.NOT NULL constraints can be defined at this level(to only
one column).
3.Composite keys can't be defined at this level
TABLE LEVEL
1.Table level constraints can be defined after defining the
all columns
2.NOT NULL constraints can't be defined at this level.
3.Composite key can be defined at this level
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / rahulnayan007@gmail.com
clc = column level constraints
tlc = table level constraints
a) tlc do not support null constraint but clc do.
b) tlc can be used to construct composite keys but clc can't.
c) tlc and clc,using both we can assign names to consraints . being applied to any column.
d)
Is This Answer Correct ? | 6 Yes | 0 No |
How to initialize variables with default values?
What is program global area (pga) in oracle?
Does oracle partitioning improve performance?
After using set unused can we enable the column again to use? Please give me some answers....
How to pass parameters to procedures?
in account table account type amount ac1 credit 300 ac2 debit 5000 ac3 credit 3000 ac1 debit 4000 ac3 debit 2000 ac2 credit 4000 write a query how to get sum of credit & sum of debit
diff between DELETE and TRUNCATE?.
14 Answers HCL, Yalamanchili Software,
What are the restrictions on external table columns?
Why does oracle 9i treat an empty string as null?
How do you tell what your machine name is and what is its IP address?
What are the advantages of oracle 12c?
We need to compare two successive records of a table based on a field. For example, if the table is CUSTOMER, and the filed is Account_ID, To compare Account_IDs of record1 and record2 of CUSTOMER table, what can be the query ?