-- Tables creation
CREATE TABLE proion
(
 proionId INTEGER,
 onomasia VARCHAR(255),
 PRIMARY KEY (proionId)
);

CREATE TABLE katigoria
(
 katigoriaid SMALLINT,
 onomasia VARCHAR(255),
 seiraEmfanisis SMALLINT,
 PRIMARY KEY (katigoriaid)
);

CREATE TABLE katigoriaProion
(
 katigoriaId SMALLINT,
 proionId INTEGER,
 FOREIGN KEY (katigoriaId) REFERENCES katigoria(katigoriaid) ON UPDATE CASCADE ON DELETE CASCADE,
 FOREIGN KEY (proionId) REFERENCES proion(proionId) ON UPDATE CASCADE ON DELETE CASCADE,
 PRIMARY KEY (katigoriaId, proionId)
);

-- Insert values to tables for the example
insert into proion values (1,'Lala');
insert into proion values (2,'Lolo');
insert into proion values (3,'Lele');
insert into proion values (4,'Xaxa');
insert into proion values (5,'Xixi');
insert into proion values (6,'Xexe');
insert into proion values (7,'Xmmm');

insert into katigoria values (1, 'Ls', 0);
insert into katigoria values (2, 'Xs', 1);

insert into katigoriaproion values (1, 1);
insert into katigoriaproion values (1, 2);
insert into katigoriaproion values (1, 3);
insert into katigoriaproion values (2, 4);
insert into katigoriaproion values (2, 5);
insert into katigoriaproion values (2, 6);
insert into katigoriaproion values (2, 7);
