The document contains SQL statements to create tables for clients, representatives, and apartments with primary and foreign keys. It then inserts sample data into the tables. Finally, it provides several SELECT statements to query data from the tables, including finding maximum and minimum prices, average price, and ordering or filtering rows based on columns.
The document contains SQL statements to create tables for clients, representatives, and apartments with primary and foreign keys. It then inserts sample data into the tables. Finally, it provides several SELECT statements to query data from the tables, including finding maximum and minimum prices, average price, and ordering or filtering rows based on columns.
The document contains SQL statements to create tables for clients, representatives, and apartments with primary and foreign keys. It then inserts sample data into the tables. Finally, it provides several SELECT statements to query data from the tables, including finding maximum and minimum prices, average price, and ordering or filtering rows based on columns.
The document contains SQL statements to create tables for clients, representatives, and apartments with primary and foreign keys. It then inserts sample data into the tables. Finally, it provides several SELECT statements to query data from the tables, including finding maximum and minimum prices, average price, and ordering or filtering rows based on columns.
2-INSERT INTO Client (codecl,nomcl,prenomcl,villecl) VALUES (C1,jerbi,Ali,Tunis);
INSERT INTO Client (codecl,nomcl,prenomcl,villecl) VALUES (C2,ayadi,Sami,Sfax); INSERT INTO Client (codecl,nomcl,prenomcl,villecl) VALUES (C3,zaydi,Hela,Sousse);
INSERT INTO Representant (coderep,nomrep,prenomrep) VALUES (R1,Tounsi,Ala);
INSERT INTO Representant (coderep,nomrep,prenomrep) VALUES (R2,Sfaxi,hedi); INSERT INTO Representant (coderep,nomrep,prenomrep) VALUES (R3,Gabsi,amine); INSERT INTO Appartement (ref,superficie,prix,Coderep,codecl) VALUES (A1,500,100,R2,C1); INSERT INTO Appartement (ref,superficie,prix,Coderep,codecl) VALUES (A2,700,50,R1,C1); INSERT INTO Appartement (ref,superficie,prix,Coderep,codecl) VALUES (A3,900,150,R2,C3);
3-SELECT * FROM Representant;
-SELECT Villecl FROM Client ; -SELECT ROW_NUMBER() AS num_row FROM Client; -SELECT * FROM Client WHERE codecl = C2; -SELECT MAX(prix) FROM Appartement; -SELECT MIN(prix) FROM Appartement; -SELECT * FROM Client ORDER BY prenomcl ; -SELECT * FROM Representant WHERE nomrep=Sfaxi AND prenomrep=hedi; -SELECT AVG(prix) FROM Appartement;