By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3798712 fiddles created (41860 in the last week).
create table meno_rusis(
id INTEGER not null check (id > 100),
pavadinimas VARCHAR (100) not null,
primary key(id)
);
create table autorius(
id INTEGER not null check (id > 1000000),
vardas VARCHAR (40) not null,
pavarde VARCHAR (55) not null,
gimimo_metai DATE,
primary key(id)
);
create table klientas(
id INTEGER not null check (id > 1000000),
vardas VARCHAR (40),
pavarde VARCHAR (55),
primary key(id)
);
✓
✓
✓
hidden batch(es)
create table kurinys(
id INTEGER not null check (id > 10000),
pavadinimas VARCHAR (55) not null,
metai INT,
meno_rusies_id INTEGER not null check (meno_rusies_id > 100),
autoriaus_id INTEGER not null check (autoriaus_id > 1000000),
kliento_id INTEGER not null check (kliento_id > 1000000),
ilgis_cm DECIMAL (100,2),
plotis_cm DECIMAL (100,2),
kaina DECIMAL (100,2),
primary key (id),
foreign key (meno_rusies_id)
REFERENCES meno_rusis on delete cascade on update restrict,
foreign key (autoriaus_id)
REFERENCES autorius on delete cascade on update restrict,
foreign key (kliento_id)
REFERENCES klientas on delete cascade on update restrict
);