# Defining a primary key

A **primary key (PK)** is a field which contains keys unique for each record. When you add input fields to your Qommentary Form, you will need to designate one field as the primary key.

There are two (2) types of primary keys:

<table><thead><tr><th width="150">Type</th><th>Description</th><th>Supported fields</th></tr></thead><tbody><tr><td>Input</td><td>Primary key is determined by a field present in the form</td><td>Text, Number and Dropdown</td></tr><tr><td>Autonumeric</td><td>Primary key is generated by the database</td><td>n/a</td></tr></tbody></table>

### Defining an Input PK

To setup a connection with an *Input* primary key type, please follow these steps:

1\. Edit the extension's properties

2\. Expand the *Data Connections* section

3\. Set the *Primary key Type* to **Input field**

<div align="left"><img src="https://3028830514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUSRPWcyYI4YAL7ad9DIS%2Fuploads%2FzvWl632OR0vykRq1oFpu%2Fimage.png?alt=media&#x26;token=c68f6660-86fd-400e-b217-b2f6ef486b74" alt=""></div>

4\. Expand *Input fields* and select the input field to nominate as primary key

5\. Click on the switch control to select input field as **Primary key**

![](https://3028830514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUSRPWcyYI4YAL7ad9DIS%2Fuploads%2FDm8ws0K4wb8Mpz6bh3i6%2Fimage.png?alt=media\&token=6dcf6602-c274-4900-8400-b282b9c61440)

### Defining an **Autonumeric** PK

To setup a connection with an *Autonumeric* primary key type, please follow these steps:

1\. Edit the extension's properties

2\. Expand the *Data Connections* section

3\. Set the *Primary key Type* to **Autonumeric**

![](https://3028830514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUSRPWcyYI4YAL7ad9DIS%2Fuploads%2F0zytamA2CmtPM7sAoPWy%2Fimage.png?alt=media\&token=20e45d8b-1328-46ef-8822-7abadce2df58)

6\. Enter *Key column name* for the selected connection

![](https://3028830514-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUSRPWcyYI4YAL7ad9DIS%2Fuploads%2FmrYZZtnBLJe2MiOBDk9O%2Fimage.png?alt=media\&token=de55a429-417b-410a-9666-48246ce7c68e)&#x20;

###
