-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice-7.sql
More file actions
27 lines (20 loc) · 1.47 KB
/
practice-7.sql
File metadata and controls
27 lines (20 loc) · 1.47 KB
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
-- What is the number of reviews and date of the latest review, by property type?
SELECT listings.property_type, count(*), MAX(reviews.date_reviewed)
FROM reviews
INNER JOIN listings ON reviews.listing_id = listings.id
GROUP BY listings.property_type;
-- +-------------------------------------+----------+----------------------------+
-- | Boat | 2 | 2021-06-19 |
-- | Entire bungalow | 424 | 2021-10-18 |
-- | Entire condominium (condo) | 26518 | 2021-10-18 |
-- | Entire cottage | 129 | 2021-10-12 |
-- | Entire guest suite | 11176 | 2021-10-18 |
-- | Entire guesthouse | 3577 | 2021-10-18 |
-- | Entire home/apt | 21 | 2019-10-19 |
-- | Entire loft | 8416 | 2021-10-17 |
-- | Entire place | 10 | 2019-03-31 |
-- | Entire rental unit | 149681 | 2021-10-18 |
-- | Entire residential home | 13889 | 2021-10-18 |
-- | Entire serviced apartment | 1271 | 2021-10-17 |
-- | Entire townhouse | 3588 | 2021-10-17 |
-- | Entire villa | 75 | 2021-10-12 |