Skip to Content search facebook instagram pinterest twitter youtube

Misc SQL queries

These are queries which may be useful in administration, but aren't defined as an actual database tool.

Find empty pages

These are pages where the live revision doesn't have any content blocks.

SELECT page.id, page.name
FROM ~pages AS page
INNER JOIN ~page_revisions AS rev ON rev.page_id = page.id
LEFT JOIN ~page_widgets AS widg ON widg.page_revision_id = rev.id
WHERE rev.status = 'live'
GROUP BY rev.id
HAVING COUNT(widg.id) = 0