-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab-4-2.sql
More file actions
37 lines (30 loc) · 1000 Bytes
/
lab-4-2.sql
File metadata and controls
37 lines (30 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- What are the first and last names of the players who
-- played for the 2020 Chicago Cubs?
SELECT players.first_name, players.last_name
FROM stats
INNER JOIN players ON players.id = stats.player_id
INNER JOIN teams ON teams.id = stats.team_id
WHERE teams.year = 2020
AND teams.name = "Chicago Cubs"
group by players.last_name, players.first_name
-- Hint: combine WHERE clauses using AND, e.g.
-- WHERE column1 = expression1
-- AND column2 = expression2
-- Expected result: 47 rows starting with
--
-- +------------+-----------+
-- | Jason | Adam |
-- | Albert | Almora |
-- | Adbert | Alzolay |
-- | Javier | Baez |
-- | David | Bote |
-- | Rex | Brothers |
-- | Kris | Bryant |
-- | Victor | Caratini |
-- | Andrew | Chafin |
-- | Tyler | Chatwood |
-- | Willson | Contreras |
-- | Yu | Darvish |
-- | Matt | Dermody |
-- | Billy | Hamilton |
-- | Ian | Happ |