-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathqueries.sql
More file actions
41 lines (38 loc) · 1.58 KB
/
queries.sql
File metadata and controls
41 lines (38 loc) · 1.58 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- SELECT business_id from review
-- where business_id
-- in (SELECT DISTINCT business_id FROM category LEFT JOIN business on business.id = category.business_id
-- where category.category = 'Hotels'and business.name LIKE '%Hilton%');
-- SELECT DISTINCT category.business_id as business_id,
-- category.category as category,
-- business.name as business_name,
-- business.city as city,
-- business.state as state,
-- business.stars as business_stars,
-- review.stars as review_stars,
-- review.date as review_date,
-- review.user_id as user_id,
-- review.text as text,
-- review.useful as useful_vote,
-- review.funny as funny_vote,
-- review.cool as cool_vote
-- FROM category LEFT JOIN business ON business.id = category.business_id
-- INNER JOIN review ON category.business_id = review.business_id
-- WHERE category.category = 'Hotels' AND business.name LIKE '%Hilton%'
SELECT DISTINCT category.business_id as business_id,
category.category as category,
business.name as business_name,
business.city as city,
business.state as state,
business.stars as business_stars,
review.stars as review_stars,
review.date as review_date,
review.user_id as user_id,
review.text as text,
review.useful as useful_vote,
review.funny as funny_vote,
review.cool as cool_vote
FROM category LEFT JOIN business ON business.id = category.business_id
INNER JOIN review ON category.business_id = review.business_id
WHERE category.category = 'Hotels' AND business.city LIKE '%Las Vegas%'
AND business.name LIKE '%Caesars Palace Las Vegas Hotel & Casino%'
AND review.date > '2016'