In our relational system we want a way to make each row unique so we can tell them apart and ensure when we query the table we will be able to identify each row. To assist us in this we use a primary key—a column or combination of columns that contain values that uniquely identify each row in the table. Most often this is a number that simply increments as a new row is added, but has no meaning to the data in the table. Sometimes a primary key can be used from the data we are collecting—we can identify a column that will not repeat. Primary Keys become very important when we try to relate one table to another. We will get into this in lesson 6 on joins under Foreign Keys.


Want to follow along on your own database?

Do you want to follow along with the examples?  We have created a sample database you can use to follow along and try in your own database.  Go to the download page and follow the instructions.  Have fun on the SQL trail!