Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Primary keys – the basics
7. Primary keys – summary
Single-column primary keys
Multi-column primary keys
NOT NULL
Review

Instruction

Good! Again, we have failed to add the new row. The database won't let us add a NULL value as the primary key.

So, to sum up, here is what we've learned so far:

  1. The primary key must always have a value, it can't be a NULL.
  2. There can only be one row with a given primary key value.

It is worth noting that when we create a primary key, an index is also created. An index is a data structure that facilitates data selection and sorting within the table. Indexes are outside the scope of this course, but they are an important part of database design. You will have a chance to learn about them in another course.

Exercise

Click the Next exercise button to continue.