Page 1 sur 1

Correction exo SQL

Posté : 12 avr. 2015, 15:24
par tofoo
Hello,

Je suis nouveau sur le forum, Je fais un exo d'sql et j'aimerais savoir si je vais dans le droit chemin.
Voici la BDD (désolé c'est flou)
http://imagesia.com/test-sql_wjel

Question 1 : Write SQL to show details of manager who manages more than 3 employees

ma réponse :
select * from employees em, job_history jh, departments dep
where jh.employees_ID=em.employees_ID
and jh.end_data is null
and dep.manager_ID=em.manager_ID
having (em.employees_ID)>3;

Question 2 : Write SQL to show country name, city and number of departments where department has more than 5 employees

ma réponse :
select co.country_name, lo.city, lo.postal_code
from countries co, locations lo, employees em, departments dep
where co.countries_ID=lo.countries_ID
and lo.location_ID=dep.location_ID
and dep.manager_ID=em.manager_ID
having (em.employees_ID)>5;

Question 3 : Write SQL to show the details of employees drawing the highest salary in the department

ma réponse :
select em.*, jo.jobs_titles
from employees em, jobs jo
where em.job_ID=k=jo.em.job_ID
and max(max_salary);

Question 4 : Write SQL to show employee name, job title, start date and end date of past jobs of all employees with commission percentage null

ma réponse :
select em.first_name,em.last_name, jo.jobs_titles, jh.start_date, jh.end_date
from employees em, jobs jo, job_history jh
where em.commission_pct is null;

Je sais que vous allez me dire que google is my best friend ou me demander d’exécuter le code mais c'est un exercice papier donc je n'ai pas la bdd a disposition

Merci pour votre aide