So I have created a database which looks like that.
CREATE TABLE Budova
(
BudovaID int primary key not null,
BytyPocet int not null,
);
CREATE TABLE Skupina
(
SkupinaID int primary key not null,
NajemniciPocet int not null,
BytID int not null,
FOREIGN KEY (BytID) REFERENCES Byt(BytID) ON DELETE CASCADE,
);
CREATE TABLE Najemnici
(
NajemnikID int primary key not null,
Jmeno varchar(255) null,
Prijmeni varchar(255) null,
Vek int null,
SkupinaID int not null,
BytID int not null,
CenaEnergii int not null,
FOREIGN KEY (BytID) REFERENCES Byt(BytID),
FOREIGN KEY (SkupinaID) REFERENCES Skupina(SkupinaID)
);
CREATE TABLE Byt
(
BytID int primary key not null,
BudovaID int not null,
OpravaID int not null,
FOREIGN KEY (BudovaID) REFERENCES Budova(BudovaID) ON DELETE CASCADE,
FOREIGN KEY (OpravaID) REFERENCES Opravy(OpravaID) ON DELETE CASCADE
);
CREATE TABLE Vydaje
(
BytID int not null,
Voda int not null,
Elektrina int not null,
Plyn int not null,
Zaloha int not null,
Celkem int not null,
CelkemEura int not null
FOREIGN KEY (BytID) REFERENCES Byt(BytID)
);
CREATE TABLE Opravy
(
OpravaID int primary key not null,
OpravaTyp varchar(255) not null,
OpravaCena int not null,
);
I have basically 6 tables in the database but when I've tried to create database diagram, it haven't shown every single table. As you can see, it shows only 5 of them.
At the end, it looks like that.
I've tried to change the references, but It went literally to hell. Do you know, what I should do to make it works?