I have table 1 :
- CREATE TABLE Zamestnanci
(id_Zamestnanca int not null,
Meno varchar(50) null,
Priezvisko varchar(50)null,
Adresa varchar(50) null,
Datum_narodenia date null,
PRIMARY KEY (id_Zamestnanca)
);*
Table 2 :
- CREATE TABLE ObčaniaSR
(id_Občana int not null,
Meno varchar(50) null,
Priezvisko varchar(50) null,
Adresa varchar(50) null,
Datum_narodenia date null,
Zápis_v_trestnom_registry varchar(50) null,
PRIMARY KEY (id_Občana)
);*
Table 3 :
*CREATE TABLE Register_priestupkov
(id_Priestupku int,
Dátum_platnosti_priestupku date,
Popis_priestupku nvarchar (150),
Trestná_sadzba_za_priestupok money,
PRIMARY KEY (id_Priestupku)
);*
Table 4 :
CREATE TABLE Priestupky
(id_Priestupku int,
id_Občana int,
id_Zamestnanca int,
dátum_spáchania_priestupku date,
Zápis_v_trestnom_registry date,
id_Trestnej_sadzby int,
PRIMARY KEY (dátum_spáchania_priestupku),
FOREIGN KEY (id_Občana) REFERENCES Občania_SR (id_Občana) ON DELETE CASCADE,
CONSTRAINT fkid_Občana FOREIGN KEY (id_Občana) REFERENCES Občania_SR (id_Občana),
FOREIGN KEY (id_Zamestnanca) REFERENCES ZAMESTNANCI (id_Zamestnanca) ON DELETE CASCADE,
CONSTRAINT fkid_Zamestnanca FOREIGN KEY (id_Zamestnanca) REFERENCES Zamestnanci (id_Zamestnanca),
FOREIGN KEY (id_Priestupku) REFERENCES Register_priestupkov (id_Priestupku) ON DELETE CASCADE,
CONSTRAINT fkid_Priestupku FOREIGN KEY (id_Priestupku) REFERENCES Register_priestupkov (id_Priestupku),
How can I select from this tablets using functions and using agregations? Can you please give me an example? Thank you for your answers and advices