There is no way to enforce the required constraints on current schema. What you need is a unique constraint, but unique constraints work on single table data, and you don't have a table that would contain a role of a member and a club information.
In order to achieve them you'll have to add new column with a role info to a clen table (member), or club info to the trener and majitel tables. Because a single member can have multiple roles, first solution is not an option.
Just adding a club would potentially cause data consistency problems (someone changes the member's club id, but not the coache's). To enforce the integrity I add foreign key on a pair (member_id, club_id).
The result is:
CREATE TABLE club ( id_club SERIAL NOT NULL, nazev VARCHAR(256) NOT NULL, datum_zalozeni VARCHAR(256) NOT NULL ); ALTER TABLE club ADD CONSTRAINT pk_club PRIMARY KEY (id_club); ALTER TABLE club ADD CONSTRAINT uc_club_nazev UNIQUE (nazev); CREATE TABLE coach ( id_member INTEGER NOT NULL ); ALTER TABLE coach ADD CONSTRAINT pk_coach PRIMARY KEY (id_member); CREATE TABLE member ( id_member SERIAL NOT NULL, id_club INTEGER NOT NULL, jmeno VARCHAR(256) NOT NULL, prijmeni VARCHAR(256) NOT NULL, narodnost VARCHAR(256) NOT NULL, datum_narozeni VARCHAR(256) NOT NULL ); ALTER TABLE member ADD CONSTRAINT pk_member PRIMARY KEY (id_member); CREATE TABLE owner ( id_member INTEGER NOT NULL ); ALTER TABLE owner ADD CONSTRAINT pk_owner PRIMARY KEY (id_member); CREATE TABLE player ( id_member INTEGER NOT NULL, cislo VARCHAR(256) NOT NULL, post VARCHAR(256) NOT NULL ); ALTER TABLE player ADD CONSTRAINT pk_player PRIMARY KEY (id_member); ALTER TABLE coach ADD CONSTRAINT fk_coach_member FOREIGN KEY (id_member) REFERENCES member (id_member) ON DELETE CASCADE; ALTER TABLE member ADD CONSTRAINT fk_member_club FOREIGN KEY (id_club) REFERENCES club (id_club) ON DELETE CASCADE; ALTER TABLE owner ADD CONSTRAINT fk_owner_member FOREIGN KEY (id_member) REFERENCES member (id_member) ON DELETE CASCADE; ALTER TABLE player ADD CONSTRAINT fk_player_member FOREIGN KEY (id_member) REFERENCES member (id_member) ON DELETE CASCADE; --We need a unique constraint on (id_member, id_club), to be able to use the pair in a foreign key. ALTER TABLE member ADD CONSTRAINT unq_member_and_club UNIQUE(id_member, id_club); --Req. 1: club (klub) can have exactly one coach (trener) ALTER TABLE coach ADD COLUMN id_club integer; ALTER TABLE coach ADD CONSTRAINT fk_coach_club FOREIGN KEY (id_club) REFERENCES club (id_club); ALTER TABLE coach ADD CONSTRAINT fk_coach_member_and_club FOREIGN KEY (id_member, id_club) REFERENCES member (id_member, id_club); ALTER TABLE coach ADD CONSTRAINT fk_single_coach_per_club UNIQUE(id_club); --Req. 2: club can have just one owner (majitel) ALTER TABLE owner ADD COLUMN id_club integer; ALTER TABLE owner ADD CONSTRAINT fk_owner_club FOREIGN KEY (id_club) REFERENCES club (id_club); ALTER TABLE owner ADD CONSTRAINT fk_owner_member_and_club FOREIGN KEY (id_member, id_club) REFERENCES member (id_member, id_club); ALTER TABLE owner ADD CONSTRAINT fk_single_owner_per_club UNIQUE(id_club);
You can test the script in db<>fiddle.
Please note, that I have added fk_coach_club and fk_owner_club foreign key constraints although they are not mandatory. fk_member_club, fk_owner_member_and_club and fk_coach_member_and_club together ensures the club_id values in owner and coach tables are always valid, but if feels natural for me to have these FK's.
Req. 3 each member (člen) can be in just one club Nothing needs to be changed in your schema, member has club attribute, there is no way to assign another club to a single member.
There is no special constraint for Req.4 a coach can set tactics (taktika) only for his club, because tactics is set by coach that is assigned to a single club, so there is no constraint required.
trener, but in your schema you have a trainer associated withclenonly.clenalso has a club assigned. The question do you want a constraint onclentable to restrict entering 2 members with the same club but different trainer, o do you allow adding new collumns to your tables (klubspecifically).trenerhas fieldid_clen. This should be interpreted as "coach is a member" ?