I saw this on the postgresql create table page:
CREATE TABLE films (
len interval hour to minute,
CONSTRAINT code_title PRIMARY KEY(code,title)
CHECK (price > 0)
That's not two primary keys, it a single, composite primary key.
It means that the primary key is made up of the two columns
title (hence the
code_title constraint name).
So, while you can have rows with duplicate codes and duplicate titles, no two rows can have the same
code title ---- ----- 0000 aaaaa Okay. 0000 bbbbb Okay. 1111 bbbbb Okay. 0000 aaaaa ** No! Conflicts with first row. **