Simple SQL Queries - Refer to the question below The schema for Part I is repeat
ID: 3756090 • Letter: S
Question
Simple SQL Queries - Refer to the question below
The schema for Part I is repeated below staff (sid, sname) project pid, pdesc, prom, pto asset (aid, acat, adesc) workfor (sid, pid. wfrom wto assignment (ad, sid, pid, atrom, ato 2. (7 points) (SQL) Find the names of the different st affs who worked or are working for more than 20 projects that started in March 2017 (each of the 20 projects started in March 2017). Print the names of these different staffs and the corresponding numbers of projects (numbers of projects refers to the quantity of projects)Explanation / Answer
The query is as follows
SELECT Staff.sname FROM Staff s
INNERJOIN workfor w ON s.sid=w.sid
GROUP BY s.sid
HAVING count(w.pid)>20 AND w.wfrom=="March 2017";
here,by using group by statement,the staff is grouped by noof project count and the workfrom date.
count method used to count the no of projects assigned by the staff.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.