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
Multi-column primary keys
NOT NULL
Review

Instruction

All right. As you can see, it's possible, but inadvisable, to use a varchar column as the primary key.

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

LEAD

Exercise

Try to create the database using the following ERD:

LEAD

Stuck? Here's a hint!

Type:

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