What is difference in defining constraints at table level and column level What is main purpose of making constraints at table level....pls ans me

Questions by basukolur014   answers by basukolur014

Showing Answers 1 - 33 of 33 Answers

Actually there is no difference between column label and column lable

its is method to define the constraints,column lable means constraints defined after the column and table lable means defining constraints  after all the column in the table.

Create table ee1(empno number primary key,ename varchar2(12)); column lable

Create table ee1(empno number ,ename varchar2(12),primary key(empno));

table lable

  Was this answer useful?  Yes

soumen sekhar sarangi

  • Nov 15th, 2006
 

From the point of view of applying constraints in a table the difference is only the place where the condition is defined.

But table level constraint has an advantage over column level that is

With table level we can define composite primary key constraint( more than one attribute can be grouped together and can be made a primary key when a single attribute is not sufficient to be the primary key)

  Was this answer useful?  Yes

ankur lodha

  • Dec 6th, 2006
 

Column level -- References a single column and is defined within a specification for the owning columns ; can define any kind of integrity constraint

Table level-- Reference one or more columns and is defined separately from the definitions of the columns in the table ; can defined any constraints except not null


  Was this answer useful?  Yes

Manikandan

  • Dec 9th, 2006
 

Thru TABLE LEVEL constraint u can specify more than one columns(constraint name is must).

In column level it is only for one column no need to specify constraint name.

  Was this answer useful?  Yes

No difference in column level constraint and table level constraint if each constraints are defined on single columns only.
If constraint has to be defined on more than one column then table level constraint is the method used.

  Was this answer useful?  Yes

debasisdas

  • Apr 11th, 2011
 

Let me explain both sides of the coin bit more clearly.

Table level Constraint
===========================
1. Constraints are defined separately after the columns are defined.
2. While defining constraints at this level constraint name must be provided
3. Not null constraints can't be defined at this level.
4. Composite keys can be defined at this level only.

A table level constraint can see every column in the table.


Column level Constraint
===========================
1. Constraints are defined along with the columns.
2. So constraint name is not required.
3. Not null constraints can be defined at this level only(NOT NULL constraint can only apply to one column).
4. Composite keys can't be defined at this level .
5. Column level constraint is more clear syntactically and more meaningful.

A column level constraint has scope only to the column it is defined on.


The major difference between the two constraint is the scope. So far as the use of constraints (validating proper data) is concerned they are pretty much the same.


Any column level constraint (exception: not null) can be expressed at the table level - but the opposite is not true.
Go for a column level constraint if the constraint is in fact a column constraint else use  a table constraint.

It is recommended to always use a column constraint if the constraint applies just to the column (and NOT a table constraint if it only applies to a single column) - you can only do it at the column level.

I have table with duplicate records in one column..but now I want to avoid duplicate records for my forth coming records for that column and previous duplicates records did not be change... Is it possible? If possible plz tel me how to do that..

Thanks in advance

  Was this answer useful?  Yes

Dhruva Joshi

  • Apr 4th, 2012
 

To define a constraint at a table level simply reduces the typing part of the
Program...logically
But. The thing is when defining constraint at a column level the rules of it just stay for the particular column but when we want it for one or many column table level
Is to be given

  Was this answer useful?  Yes

Manjesh

  • Apr 17th, 2012
 

yes, it is possible, but u have to use triggers not constraints

krishna mistry

  • Oct 10th, 2015
 

No difference in column level and table level constraints.

  Was this answer useful?  Yes

Saurabh Singh

  • Oct 12th, 2015
 

Table level constraints are defined for compound constraints like primary key involving more than one col and have the flexibility to provide user defined names to these which is not possible in case of col level constraints. Only NOTNULL constraints cant be defined as table level.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions