create table Area(id int primary key auto_increment, name varchar(100));
create table Map(id int primary key auto_increment,
area_id int not null,
name varchar(100),
foreign key (area_id) references area(id));
Každá Map MUSÍ mít Area , jako area_id není null (a je Foreign key v Area )
Ale nebudete moci (a není to žádoucí) mít „alespoň jednu mapu“ pro každou oblast.
Jednoho dne budete muset vytvořit Area . A nebude mít žádnou Map v tuto chvíli. Nebo proveďte „pravidelné“ kontroly, abyste viděli oblasti bez jakékoli mapy.
Možná budete chtít smazat Area , pokud již nemá žádnou související Map , když smažete Map .