IniziaInizia gratis

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!

Questo esercizio fa parte del corso

Introduction to Relational Databases in SQL

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

-- Add the new column to the table
ALTER TABLE ___ 
___ ___ id ___;
Modifica ed esegui il codice