This document contains SQL statements to create two tables, ELEVI and NOTE, add primary and foreign keys, insert sample data, and run queries. The ELEVI table stores student codes, names, and specializations while the NOTE table stores exam codes, subjects, dates, and grades. Several queries are run to select data from the tables.
This document contains SQL statements to create two tables, ELEVI and NOTE, add primary and foreign keys, insert sample data, and run queries. The ELEVI table stores student codes, names, and specializations while the NOTE table stores exam codes, subjects, dates, and grades. Several queries are run to select data from the tables.
This document contains SQL statements to create two tables, ELEVI and NOTE, add primary and foreign keys, insert sample data, and run queries. The ELEVI table stores student codes, names, and specializations while the NOTE table stores exam codes, subjects, dates, and grades. Several queries are run to select data from the tables.
number(2)); ALTER TABLE ELEVI ADD CONSTRAINT pk_elevi PRIMARY KEY(cod); ALTER TABLE NOTE ADD CONSTRAINT pk_note PRIMARY KEY(cod_elev); ALTER TABLE NOTE ADD CONSTRAINT fk_note FOREIGN KEY(cod_elev) REFERENCES ELEVI(cod); INSERT INTO ELEVI VALUES(1,'Popescu Ion','FB'); INSERT INTO ELEVI VALUES(2,'Georgescu Vasile','MNG'); INSERT INTO ELEVI VALUES(3,'Pintilie Mihaela','FB'); INSERT INTO ELEVI VALUES(4,'Papuc Ion','CIG'); INSERT INTO NOTE VALUES(1,'Matematica','23/02/2015',4); INSERT INTO NOTE VALUES(2,'Baze de date','19/03/2015',5); INSERT INTO NOTE VALUES(3,'Informatica','19/03/2015',6); INSERT INTO NOTE VALUES(4,'Statistica','19/03/2015',7);
SELECT *FROM ELEVI;
SELECT cod,nume,specializare FROM ELEVI; SELECT disciplina,nota+2 FROM NOTE; SELECT *FROM ELEVI WHERE nume LIKE '%escu%'; SELECT COUNT(nota) as numar_note from NOTE;