smon/sql/00003.sql
2024-04-29 08:36:13 +02:00

14 lines
371 B
SQL

CREATE TABLE public.area (
id serial NOT NULL,
name varchar NOT NULL,
CONSTRAINT area_pk PRIMARY KEY (id)
);
CREATE TABLE public.section (
id serial NOT NULL,
name varchar NOT NULL,
area_id int4 NOT NULL,
CONSTRAINT section_pk PRIMARY KEY (id),
CONSTRAINT section_area_fk FOREIGN KEY (area_id) REFERENCES public.area(id) ON DELETE RESTRICT ON UPDATE RESTRICT
);