Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLCTEs WITHSingle-choice MCQ

What does a data-modifying CTE like the one below do, given that the same statement also reads from the original table?

WITH moved AS ( DELETE FROM events WHERE created_at < now() - interval '30 days' RETURNING * ) INSERT INTO events_archive SELECT * FROM moved;