sql

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu Meta

Q&A about the site for Ubuntu users and developers

--2: How many users didn’t post any questions in year2015.(hint: use PostType table to check which post types is question)

SELECT COUNT(*)
FROM Users u
WHERE NOT EXISTS (
    SELECT 1
    FROM Posts p
    JOIN PostTypes t ON p.PostTypeId = t.Id
    WHERE p.OwnerUserId = u.Id
    AND t.Name = 'Question'
    AND YEAR(p.CreationDate) = 2015
);

Enter Parameters

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