Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #1 What's the most expensive listing? What else can you tell me about the listing?
  2.  
  3. SELECT
  4. *
  5. FROM
  6. sfo_listings l
  7. JOIN
  8. sfo_calendar c
  9. ON l.id = c.listing_id
  10. ORDER BY l.price DESC
  11. LIMIT 1
  12.  
  13. #A: listing_id = 24650875, its $10K a night, the Host is name Sarah, its and Entire Home, Min stay is 2 nights
  14. the Neighborhood is 'Western Addition'
  15.  
  16. #2 What neighborhoods seem to be the most popular?
  17.  
  18. SELECT
  19. neighbourhood,
  20. COUNT(*)
  21. FROM
  22. sfo_listings
  23. GROUP BY 1
  24. ORDER BY 2 DESC
  25.  
  26. #A: Mission, Western Addition, South of Market, Downtown, Castro
  27.  
  28. #3
  29.  
  30. SELECT
  31. l.id,
  32. c.calender_date,
  33. c.available,
  34. c.price
  35. FROM
  36. sfo_listings l
  37. JOIN
  38. sfo_calendar c
  39. ON
  40. l.id = c.listing_id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement