# Error 1068: Multiple primary key defined

| Error Code | SQLSTATE | Error                  | Description                  |
| ---------- | -------- | ---------------------- | ---------------------------- |
| 1068       | 42000    | ER\_MULTIPLE\_PRI\_KEY | Multiple primary key defined |

## Possible Causes and Solutions

No more than one [primary key](/docs/server/mariadb-quickstart-guides/mariadb-indexes-guide.md#primary-key) can be defined per table. Attempting to define more in a single table will result in this error. For example:

```
CREATE TABLE t1(
    c1 INT NOT NULL AUTO_INCREMENT, 
    c2 INT NOT NULL, 
    PRIMARY KEY(c1),
    PRIMARY KEY(c2)
);
ERROR 1068 (42000): Multiple primary key defined

CREATE TABLE t1(
    c1 INT NOT NULL AUTO_INCREMENT, 
    c2 INT NOT NULL, 
    PRIMARY KEY(c1)
);
```

It's also possible that this error results from a mistaken attempt to define a multi-part primary key. This is an example of the correct definition for such a key.

```
CREATE TABLE t1(
    c1 INT NOT NULL AUTO_INCREMENT, 
    c2 INT NOT NULL, 
    PRIMARY KEY(c1, c2)
);
```

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1000-to-1099/e1068.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
