Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the use of composite key constraint?

Answer Posted / srikanth

A composite key is used to club primary key for more than
once column.

PRIMARY KEY(<<COLUMN1>>,<<COLUMN2>>....<<COLUMNN>>)

But the disadvantage is that it will allow duplicates for
any one of the fields.

Example:

CREATE TABLE Example1
(Id INT NOT NULL,Pername VARCHAR(20) NULL,Phno INT NOT NULL
PRIMARY KEY(Id,Phno)
)

Command(s) completed successfully.

INSERT INTO Example1
VALUES(1,'sri',1111)

(1 row(s) affected)

INSERT INTO Example1
VALUES(1,'sri',6666)

(1 row(s) affected)

SELECT * FROM Example1

Id Pername Phno
1 sri 1111
1 sri 6666

As you can see that it is allowing same Id.

Basically Composite Key will take all the fields defined as
a group.So it is least bothered about any one of the field.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What privilege is needed for a user to connect to oracle server?

960


What is parameterized cursor in oracle?

1085


Is it possible to split the print reviewer into more than one region ?

2236


What is the max number of columns in an oracle table?

953


How to delete a user account in oracle?

928


What is blob datatype?

1073


What is using clause and give example?

1008


In the oracle version 9.3.0.5.0, what does each number shows?

1249


Her departmandaki isçilerden empno' su ikinci sirada olan isçilerin empno, deptno, hiredate, sira_no bigilerini döndüren sorguyu yaziniz?

1951


what is the scenario where you take the database to NoArchivelog mode?

2282


What are temporal data types in oracle?

1084


What are the restrictions on external table columns?

1010


Can the query output be sorted by multiple columns in oracle?

952


How to convert a string to a date in oracle database?

1011


How to store only time; not date and time?

980