Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. 1)
  2. CREATE VIEW mes_infos AS
  3. SELECT * FROM employe E
  4. where E.num=substring_index(user(),”@”,1);
  5.  
  6. 2)
  7. CREATE VIEW salaire_employe AS
  8. SELECT E.Nom,E.salaire
  9. FROM employe E
  10. LEFT JOIN employeDept ED ON ED.numEmploye = E.num
  11. where ED.deptId IN (SELECT D.deptId
  12. FROM departement D
  13. where D.directeur=substring_index(user(),”@”,1))
  14. AND E.num <> substring_index(user(),”@”,1)
  15.  
  16. 3) CREATE VIEW moyenne_salaire_departement AS
  17. SELECT AVG(E.salaire),D.nom FROM employes E
  18. LEFT JOIN employedept ED on E.Num = ED.NumEmploye
  19. LEFT JOIN departement D on ED.DeptId = D.DeptId
  20. group by D.DeptId;
  21.  
  22. 4) CREATE VIEW nb_employe_projet AS
  23. SELECT count(ED.NumEmploye),P.NomProjet
  24. FROM departement D
  25. LEFT JOIN employedept ED ON ED.deptId = D.deptId
  26. LEFT JOIN membreprojet MP ON MP.numemploye = ED.numemploye
  27. LEFT JOIN projet P ON P.ProjetId = MP.ProjetId
  28. LEFT JOIN employes E ON E.Num = D.directeur
  29. where D.num=substring_index(user(),”@”,1)
  30. group by P.projetId;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement