Question: I have this situation:

[MySQL - Newbie question: Which are the PK and the FK for these tables?](https://stackoverflow.com/questions/1590033/mysql-newbie-question-which-are-the-pk-and-the-fk-for-this-tables) (take a look at the table **Salaries**)

How do you create a table with multiple primary keys?

```
create table salaries
(
  dep_id smallint auto_increment primary key, 
  emp_id smallint auto_increment primary key, 
  bla varchar(20)
);

```

I receive an error if I try the code above. Any ideas?

Answer: 
A table can only have one primary key. However, the primary key can consist of multiple columns, e.g.

```
CREATE TABLE salaries (
    dep_id SMALLINT UNSIGNED NOT NULL,
    an_id SMALLINT UNSIGNED NOT NULL,
    bla VARCHAR(20),
    PRIMARY KEY (dep_id, an_id)
);

```
you can only create ONE primary key. If you want the other fields to be unique, you have to create UNIQUE CONSTRAINT