List Random Records From Table In Sql Server – Query Examples

List Random Records From Table In Sql Server

In this post we will learn how to list random record from a table in sql server. We will list the records by a condition. For list random records we use newid function after order by clause. Then with top clause, we can list the records count we want. We will write queries from the library database added at below. You can write more examples dowloading the sample library database with data from the link.

TO DOWNLOAD THE SAMPLE LİBRARY DATABASE CLICK

Example 1: List  random one student.

Example 2: List  random one student from 10A class.

Example 3: List  random three female students from 10A class.

Example 4: List random book from 5 books which has most page count.

Example 5: List random one book from most read books

 

YOU MAY WANT TO SEE OUR ALL EXAMPLES PAGE, THEN CLICK HERE

About the author

admin

Leave a Comment

%d bloggers like this: