corrections TP2 et TP3
This commit is contained in:
parent
c3df27e4e5
commit
f3a325dd19
38
Code/CorrectionsTP/TP2.sql
Normal file
38
Code/CorrectionsTP/TP2.sql
Normal file
@ -0,0 +1,38 @@
|
||||
# Q1
|
||||
select * from buveur;
|
||||
|
||||
# Q2
|
||||
select numbuveur, nom, ville from buveur ;
|
||||
|
||||
# Q3
|
||||
select numbuveur, nom from buveur where ville = 'PARIS';
|
||||
|
||||
# Q4
|
||||
select numbuveur, nom from buveur where ville = 'PARIS' or ville = 'MACON';
|
||||
|
||||
# Q5
|
||||
select cru from vin where region = 'LOIRE'
|
||||
|
||||
select distinct cru from vin where region = 'LOIRE';
|
||||
|
||||
# Q6
|
||||
|
||||
select distinct ville from buveur;
|
||||
|
||||
# Q7
|
||||
select NumCom from commande where qtte between 10 and 50;
|
||||
select NumCom from commande where qtte >10 and qtte <50;
|
||||
|
||||
# Q8
|
||||
select NumCom, dateliv from livraison where DateLiv > '01/12/1987';
|
||||
|
||||
# Q9
|
||||
select numvin, cru from vin where cru like 'B%';
|
||||
|
||||
# Q10
|
||||
select numvitic, nom from viticulteur where nom like '%LIN%';
|
||||
|
||||
# Q11
|
||||
select numbuveur, nom from buveur where ville != 'PARIS' and ville !='MACON';
|
||||
select numbuveur, nom from buveur where ville not in ('PARIS', 'MACON');
|
||||
|
49
Code/CorrectionsTP/TP3.sql
Normal file
49
Code/CorrectionsTP/TP3.sql
Normal file
@ -0,0 +1,49 @@
|
||||
-- Q1
|
||||
select B.numbuveur, nom, ville
|
||||
from buveur B, Commande C
|
||||
where B.numbuveur = C.numbuveur;
|
||||
|
||||
select distinct B.numbuveur, nom, ville
|
||||
from buveur B, Commande C
|
||||
where B.numbuveur = C.numbuveur;
|
||||
|
||||
select distinct numbuveur, nom, ville
|
||||
from buveur natural join Commande ;
|
||||
|
||||
select distinct numbuveur, nom, ville
|
||||
from buveur join Commande using(numbuveur) ;
|
||||
|
||||
select distinct b.numbuveur, nom, ville
|
||||
from buveur b join Commande c on (b.numbuveur=c.numbuveur);
|
||||
|
||||
|
||||
-- Q2
|
||||
select distinct numvitic, nom, prenom
|
||||
from viticulteur natural join vin
|
||||
where region = 'LOIRE' and millesime = 1983;
|
||||
|
||||
-- Q3
|
||||
select distinct B.numbuveur, nom
|
||||
from buveur b, commande c, vin v
|
||||
where b.numbuveur = c.numbuveur and c.numvin=v.numvin and cru = 'POMMARD' ;
|
||||
|
||||
select distinct numbuveur, nom
|
||||
from buveur natural join commande natural join vin
|
||||
where cru = 'POMMARD';
|
||||
|
||||
-- Q4
|
||||
select distinct nom
|
||||
from vin v, commande c, viticulteur t
|
||||
where c.numvin = v.numvin and v.numvitic = t.numvitic and numbuveur = 1600;
|
||||
|
||||
select distinct nom
|
||||
from commande natural join vin natural join viticulteur
|
||||
where numbuveur = 1600;
|
||||
|
||||
select distinct nom
|
||||
from viticulteur
|
||||
where numvitic in (select numvitic
|
||||
from vin
|
||||
where numvin in (select numvin
|
||||
from commande
|
||||
where numbuveur = 1600));
|
Loading…
Reference in New Issue
Block a user