Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
CREATE TABLE destinations
(
	destinationI_id		int	primary key,
	country    			varchar(40),
	location   			varchar(40),
    traveller			int,
    foreign key (traveller) references travellers(traveller_id)
);

How to create a composite key

You will to define the column using this syntax, anything in bold is keyword, the other parts your field names

Info

constraint visit_key primarykey (destination, purpose, date_of_visit)

Code Block
languagesql
CREATE TABLE visits
(
	date_of_visit		date,
	destination    		int,
	purpose   			int,
    foreign key (destination) references destinations(destination_id),
    foreign key (purpose) references purpose(id),
    constraint visit_key primary key (destination, purpose, date_of_visit)
);