Avoid Data Duplication

If in a table we dont use primary key or any other unique key then how to avoid duplication of data?

Questions by maheshk_222

Showing Answers 1 - 6 of 6 Answers

You can create a unique index on the column/columns of a table.

A unique index can be created  as follows :

CREATE UNIQUE INDEX dept_unique_index ON dept (dname)


Here,  dept_unique_index is the name of the unique index.
dept  is the table name.
dname is the column on which the unique index will be created.

vinodsahani

  • May 18th, 2010
 

You can use exists/not exists, but that unnecessary delays your insert command as every insert will be thoroughly checked, better apply unique constraint. PS: Additionally you can use distinct command to check for duplicacy.

  Was this answer useful?  Yes

Ehsan Rehmani

  • Feb 1st, 2013
 

We must constraint the column with primary key when designing the database to avoid the duplications.

  Was this answer useful?  Yes

Ehsan Rehmani

  • Apr 23rd, 2013
 

Its impossible to avoid duplication without constraint the PK on Column

  Was this answer useful?  Yes

manohar reddy

  • Apr 4th, 2015
 

We can do it by validating the data before insertion in Trigger

  Was this answer useful?  Yes

sravani

  • Apr 7th, 2015
 

It is possible by using unique constrain on that column we can avoid duplication of data

  Was this answer useful?  Yes

prakash

  • Aug 6th, 2015
 

By creating unique index it is possible

  Was this answer useful?  Yes

PremG

  • Aug 10th, 2015
 

Yes, by creating Unique index on the respective column we can avoid duplicate values into that particular column. But, with this NULL values can not be restricted.

  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