Q&A about the site for power users of web applications
-- Get 1000 random posts from the last year -- Using TABLESAMPLE for better performance on large datasets -- Filtering for non-deleted posts from last year SELECT TOP 1000 * FROM PostsWithDeleted TABLESAMPLE (10 PERCENT) -- Adjust percentage based on table size WHERE CreationDate >= DATEADD(year, -1, GETDATE()) AND CreationDate <= GETDATE() AND DeletionDate IS NOT NULL -- Only non-deleted posts ORDER BY NEWID() -- Random ordering