Get startedGet started for free

Add a SERIAL surrogate key

Since there's no single column candidate key in professors (only a composite key candidate consisting of firstname, lastname), you'll add a new column id to that table.

This column has a special data type serial, which turns the column into an auto-incrementing number. This means that, whenever you add a new professor to the table, it will automatically get an id that does not exist yet in the table: a perfect primary key!

This exercise is part of the course

Introduction to Relational Databases in SQL

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Add the new column to the table
ALTER TABLE ___ 
___ ___ id ___;
Edit and Run Code