Task 11 Queries with aggregates (Pt. 2) Flashcards
(3 cards)
1
Q
Find the number of Artists in the studio (without a HAVING clause)
A
SELECT role, COUNT(*) as Number_of_artists
FROM employees
WHERE role = “Artist”;
2
Q
Find the number of Employees of each role in the studio
A
SELECT role, COUNT(*)
FROM employees
GROUP BY role;
3
Q
Find the total number of years employed by all Engineers
A
SELECT role, SUM(years_employed)
FROM employees
GROUP BY role
HAVING role = “Engineer”;