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

List the parts of a database trigger.

990


what's query optimization and without use of IN AND Exist can we get another way data from query

2090


Can you create a synonym without having a table?

980


How to experiment a data lock in oracle?

1001


Briefly explain what is literal? Give an example where it can be used?

975


What is a nvl function? How can it be used?

960


Explain an extent?

1051


What is Trigger in Oracle?

1076


Can you tell me how to add new column in existing views?how?How is possible?

1372


Explain what are synonyms used for?

983


Can u please explain me the Discussion on Except ,using cast like type cast. Question in the context of difference between two tables

1998


What operating systems are supported by oracle database 10g xe?

985


How many types of auditing in Oracle?

983


Can multiple columns be used in group by in oracle?

930


How do you get nicely formatted results from an oracle procedure that returns a reference cursor?

1010