# Compound Primary Keys

**URL:** <https://forum.kirupa.com/t/compound-primary-keys/242366>\
**Category:** programming\
**Created:** [October 25, 2007, 7:14am UTC](https://forum.kirupa.com/t/compound-primary-keys/242366 "2007-10-25T07:14:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deltawing1](https://avatars.discourse-cdn.com/v4/letter/d/d26b3c/32.png) [@deltawing1](https://forum.kirupa.com/u/deltawing1)\
**Post date:** [October 25, 2007, 7:14am UTC](https://forum.kirupa.com/t/compound-primary-keys/242366/1 "2007-10-25T07:14:51Z")

</div>

OK I’m so confused about composite primary keys. I know exactly what they are and what they do in _theory_, but I’m having trouble implementing them.

I know that multiple columns in a table make up a composite primary key. Problem is, how do I retrieve a composite primary key if it’s made up of so many columns? Or do I need an EXTRA column that combines the results of all the columns into a single string?

Please help \>.\<

Help very much appreciated!

P.S What’s the difference between “unique” and “primary” keys? I thought they were the same thing, and then someone says to me that I need to make my primary keys unique??? I thought by declaring a column a primary key in mySQL (i use auto-increment) puts a primary key constraint on the column … which ensures uniqueness!
