SELECT Tags.TagName, COUNT(DISTINCT Posts.Id) as Question...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Lifehacks Meta

Q&A about the site for people looking to bypass life's everyday problems with simple tricks

-- Query 4: Alternative Accommodation Analysis
-- Helps understand vacation rental trends (relevant to Question 2)
SELECT 
    Tags.TagName,
    COUNT(DISTINCT Posts.Id) as QuestionCount,
    AVG(CAST(Posts.Score as FLOAT)) as AvgScore,
    COUNT(DISTINCT Answers.Id) as AnswerCount
FROM Posts
LEFT JOIN PostTags ON Posts.Id = PostTags.PostId
LEFT JOIN Tags ON PostTags.TagId = Tags.Id
LEFT JOIN Posts Answers ON Posts.Id = Answers.ParentId
WHERE Tags.TagName IN ('airbnb', 'vacation-rentals', 'apartments', 'hotels', 'hostels')
    AND Posts.PostTypeId = 1
GROUP BY Tags.TagName
ORDER BY QuestionCount DESC;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results