# Non-Clustered Index for Primary Key
```
tidb> CREATE TABLE test.example_table1 (
  example_id BIGINT PRIMARY KEY ~!@NONCLUSTERED@!~,
  example_content VARCHAR(60)
);

tidb> CREATE TABLE test.example_table2(
  example_pk1 INT,
  example_pk2 VARCHAR(10),
  example_content VARCHAR(60),
  PRIMARY KEY (example_pk1, example_pk2) ~!@NONCLUSTERED@!~
);

tidb> SELECT TABLE_NAME, TIDB_PK_TYPE
  FROM information_schema.tables 
  WHERE table_schema = 'test' 
  AND table_name in ('example_table1','example_table2');

+----------------+--------------+
| TABLE_NAME     | TIDB_PK_TYPE |
+----------------+--------------+
| example_table1 | ~!@NONCLUSTERED@!~ |
| example_table2 | ~!@NONCLUSTERED@!~ |
+----------------+--------------+
```

![`smart`](NonClusteredTableWithPrimaryKey_en_001_20231116.png)
------------------------------------------------------------------------------
For a non-clustered index on a primary key, each row is represented by two `key-value` pair entries in TiKV. One entry maps the primary key to the hidden primary key, it serves as the unique index for the table. While the other entry maps the hidden primary key to the row value, it serves as the record for the table structure. So, TiDB also generates a hidden primary key column named `_tidb_rowid` in this scenario, similar to clustered index for hidden primary key.

To create a table with a non-clustered index for the primary key, use the `NONCLUSTERED` attribute while declaring the primary key.

The TiKV `KV` entries comprise the following `key` and `value` pairs:
- The index record key is the primary key value with the index `ID` prefix.
- The index record value is the hidden primary key column `_tidb_rowid`.
- The table row record key is the hidden primary key column `_tidb_rowid` with the table `ID` prefix.
- The table row value consists all columns of the row.

A table with a non-clustered index on its primary key is also known as a Heap-Organized table. 