-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.sql
More file actions
15 lines (14 loc) · 670 Bytes
/
2.sql
File metadata and controls
15 lines (14 loc) · 670 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# ------------------------------------------------------
# 2. show the name of project, with have biggest price
# ------------------------------------------------------
SELECT mtm_project_developers.mtm_id_project AS id_project,
projects.name_project AS costly_project,
sum(developers.salary) AS biggest_price
FROM projects
LEFT JOIN mtm_project_developers ON
projects.id = mtm_project_developers.mtm_id_project
LEFT JOIN developers ON
mtm_project_developers.mtm_id_developer = developers.id
GROUP BY projects.name_project
ORDER BY biggest_price DESC LIMIT 1;
# ------------------------------------------------------