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 |
What are the types of partitions in oracle?
What is varray?
How can we view last record added to a table?
What is indexing, and how does it improve performance?
How to use in conditions in oracle?
Which database is better for os platform dependency?
What are the oracle differences between nvl and coalesce
How to find the date and time of last updated table?
From the following identify the non schema object: packages, triggers, public synonyms, tables and indexes.
Can we commit inside a function in oracle?
What are the most common interview questions on ETL Testing for experience?
what is the use of triggers in Java program? I mean where do we use triggers in Java programming?