Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Primary keys - the basics
Single-column primary keys
10. Primary keys in ERD
Multicolumn primary keys
Auto-increment columns and sequences
Revision

Instruction

Alright. As you can see, it's possible to use a varchar column as the primary key, but it is not advisable.

Primary keys are important, so we mark which column the primary key is in ERD diagrams too. We usually use the abbreviation PK:

The movie table

Exercise

Try to create the database using the following ERD diagram:

The account table

Stuck? Here's a hint!

Type

CREATE TABLE account (
   user_id int PRIMARY KEY,
   first_name varchar(32),
   nickname varchar(24),
   description text
);