Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Identity columns
Sequences
Summary

Instruction

Good! As you saw, we only had odd numbers as IDs in the cinema table.

It's time for you to create your own table with a custom id column.

Exercise

Our theaters want to introduce a subscription model with a monthly fee and an unlimited number of tickets. Create the table subscription with the following columns:

  1. id – An integer and the primary key. The value starts at 10 and increases by 10 (i.e., 10, 20, 30...) and should be GENERATED ALWAYS.
  2. user_id – An integer.
  3. start_date – A date (data type date).
  4. duration_days – An integer.

Stuck? Here's a hint!

Here's the syntax reminder:

CREATE TABLE theater (
  theater_id integer GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 2) PRIMARY KEY,
  name varchar(30),
  city varchar(30)
);