Académique Documents
Professionnel Documents
Culture Documents
Use TP1
Create table client (IdC int primary key, Nom varchar (100) Not Null, Prenom varchar (100) Not Null,
Ville varchar (100) Not Null) Execute
Explication :
Create table Produit ( IdP int primary key, Libelle varchar (100) Not Null, Prix float check (Prix > 0 )
Not Null) Execute
Create table Vente (Idv int primary key, IdP int, IdP int, DateV date,
Foreign key (IdC) references Client (IdC) on delate cascade on update set null,
Foreign key (IdP) references Produit (IdP) on delate cascade on update set null,
Execute
Update produit set Prix -= Prix*0.2 Execute ( Réduction de 20% sur tous les produits)
Insert into client select top 1 10, Nom, Prenom, Ville from Client
Delate from client where IdC Not in (Select IdC from Vente)
Select * From produit where prix in (select Max(prix) From Produit) Determiner le produit le plus
cher
Select * from client where IdC in (select IdC from vente group by IdC having Count(IdC) >= All (Select
Count(IdC) from vente group by IdC )