I started to learn SQL recently. I downloaded some kind of assignment, where the goal is to design small database. I have two tables listed below:
create table SEA ( SEA_NAME varchar(50)constraint sea_prj_key primary key, AREA numeric(18, 0), );
create table NATION ( CTRY_NAME varchar(50)constraint sea_prj_key primary key, AREA numeric(18, 0), );
Since more than one country can lie by one sea, and also one coutry can lie by more than one sea, I've created the third table:
create table SEA_BORDER ( CTRY_NAME varchar(50)references NATION(CTRY_NAME), SEA_NAME varchar(50)references SEA(SEA_NAME), BORDER numeric(18, 0) );
The problem is that there can be a Country that doesn't lie by the sea, but there can't be sea, that doesn't create a border of any country. I have completly no idea how to solve that problem. Dont know if I should create another column/table or create some constraint. So I need a guide where I should look for solution.