diff options
| author | mo khan <mo.khan@gmail.com> | 2020-01-01 12:58:28 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-01-01 12:58:40 -0700 |
| commit | bcbbacae9b14c0e233c3c3027ad9943db1fd338d (patch) | |
| tree | 7723e9a77bd5df38520cfdd8571f1932b93dc55b /labs/2/run.sql | |
| parent | ae55501aa2a5b84417ab816cf507f86d79251e0f (diff) | |
Retrieve count of users in each department working on mobile projects
Diffstat (limited to 'labs/2/run.sql')
| -rw-r--r-- | labs/2/run.sql | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/labs/2/run.sql b/labs/2/run.sql index 38aa0ef..0b070e2 100644 --- a/labs/2/run.sql +++ b/labs/2/run.sql @@ -97,3 +97,10 @@ CREATE TRIGGER update_sin AFTER UPDATE EXECUTE PROCEDURE update_referenced_sin_numbers(); UPDATE departments SET dnumber = 14 where dnumber = 12; + +SELECT departments.dname, count(distinct(employees.sin)) +FROM departments +INNER JOIN employees on employees.dno = departments.dnumber +INNER JOIN projects on projects.dnum = departments.dnumber +WHERE projects.pname LIKE 'Mobile %' +GROUP BY departments.dnumber; |
