Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
SQL / POSTGRESQL / Learn / LESSON 03
NOT NULL forbids missing values. DEFAULT fills omitted columns. UNIQUE requires distinct values. CHECK limits valid values, e.g. pages > 0.
Small example:
CREATE TABLE books (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL UNIQUE,
pages INTEGER NOT NULL DEFAULT 1 CHECK (pages > 0)
);The database starts empty. Grading checks the schema/data you create across variants.
Expected verify columns: column_name, column_name, is_nullable, has_default, constraint_type, id, title, pages · row order is checked
Expected final state (displayed data):
Loading…NOT NULL forbids missing values. DEFAULT fills omitted columns. UNIQUE requires distinct values. CHECK limits valid values, e.g. pages > 0.
QUERY STANDBY
›