Stratified sampling sql

This article is tagged with: Stratified sampling sql and mysql

stratified sampling sql

select d.*
from (select d.*,
row_number() over (order by coursecode, newid) as seqnum,
count(*) over () as cnt
from degree d
) d
where seqnum % (cnt / 500) = 1;

This article is tagged with: Stratified sampling sql and mysql