Exercice 1
EMPLOYES (Id, Nom, Age, Salaire, Profession, #Dep)
DEPARTEMENT (Id_Dep, Nom_Dep)
3. SELECT Id, Nom FROM Employes WHERE Salaire>7000 AND age BETWEEN 25 AND 30;
Id Nom
2 Mohamed
5 Omar
7 Mostapha
Informatique 8500.20
Stratégies 7000.00
DATEEMB
PROF='TECHNICIEN
EMP
Algèbre : πDATEEMB(σPROF='TECHNICIEN'(EMP))
R
2. Les numéros des employés travaillant à BOSTON.
ENO
DEPT
3. Les noms des directeurs des départements 1 et 3. (Attention : directeur n’est pas une profession)
ou
select ENOM from EMP,DEPT ⋈
EMP.DNO=DEPT.DIR
where DEPT.DNO in (1,3) ^ EMP.DNO=DEPT.DIR ;
EMP DEPT
R2=πENOM,DNO( EMP)
ENOM/DIRNOM, DNO ENOM, DNO
les noms des employés avec les noms de directeur
R=πENOM,DIRNOM( R1⋈R2) ⋈
EMP.DNO=DEPT.DIR
EMP
EMP DEPT
select E1.ENOM, E2.ENOM from EMP E1, EMP E2, DEPT D
where E1.DNO=D.DNO ^ E2.ENO = D.DIR;
R = DEPT-(DEPT ⋈EMP) -
select * from DEPT where DNO not in (select DNO from EMP);
⋈
DEPT
DEPT EMP
6. Les noms des employés embauchés avant tous les employés du département 1. R
R1 = πDATEEMB(σDNO=1(EMP)) -
R2= EMP ⋈ EMP.DATEEMB > R1.DATEEMB R1
EMP R2
R = πENOM(EMP – R2)
DATEEMB
DNO=1
EMP