instruction: How many questions are reopened after being closed and edited?.
response: WITH closed_and_edited AS (SELECT c.PostId, MIN(e.CreationDate) AS EditDate FROM PostHistory AS c INNER JOIN PostHistory AS e ON c.PostId = e.PostId AND c.PostHistoryTypeId = 10 AND e.PostHistoryTypeId = 5 AND c.CreationDate < e.CreationDate GROUP BY c.PostId) SELECT COUNT(*) AS "Closed and edited", COUNT(oa.PostId) AS "Closed, edited and reopened", ROUND(COUNT(oa.PostId) * 100.0 / COUNT(*), 2) AS "%" FROM closed_and_edited AS q LEFT JOIN LATERAL (SELECT PostId FROM PostHistory WHERE PostId = q.PostId AND PostHistoryTypeId = 11 AND CreationDate >= q.EditDate) AS oa