Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

composite key syntax 1

Status
Not open for further replies.

MasterKaos

Programmer
Jan 17, 2004
107
GB
Hi i know this is a simple question, but i couldn't find it in the manual.

Whats the syntax for creating a composite primary key?

I need to create an associative entity out of the primary keys tour_id (from tour table) and pickup_id (from pickup table)

----------------------------------------------------------------------------
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
 
create table AssociativeEntity
( tour_id integer not null
, pickup_id integer not null
, foreign key (tour_id) references Tours (id)
, foreign key (pickup_id) references Pickups (id)
,primary key (tour_id, pickup_id)
);

rudy
SQL Consulting
 
Thank you r937!!!

Man, tek-tips rocks. So much better than reading the manual :p

----------------------------------------------------------------------------
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top