Hello coders! In this post I have shared the details about “sql random sampling per group”. Okay, let’s move on to the article.
sql random sampling per group
with randomly_sorted_users as ( select user_id, signup_date, row_number() over(partition by date_trunc('year', signup_date) order by random()) as random_sort from user_table ) select user_id, signup_date from randomly_sorted_users where random_sort <= 5
I hope this article helps you to know about “sql random sampling per group”. If you have any doubts regarding this article please let us know via the comment section. Share this article with your friends and family via social networks.