-- Create the table
Create Table Emp (Id int, Name varchar(50), Address varchar(500), Gender varchar(10))
GO
-- Insert Values in Table
Insert Into Emp values (1, 'Jitendra', 'Agra', 'Male')
Insert Into Emp values (2, 'Ram', 'Noida', 'Male')
Insert Into Emp values (3, 'Shayam', 'Delhi', 'Male')
Insert Into Emp values (4, 'Rohan', 'Ghaziabad', 'Male')
Insert Into Emp values (5, 'Sarita', 'Noida', 'Female')
Insert Into Emp values (6, 'Ruby', 'Noida', 'Female')
Insert Into Emp values (7, 'Abhi', 'Delhi', 'Male')
Insert Into Emp values (8, 'Atul', 'Ghaziabad', 'Male')
Go
-- Query for Get the Random Row from Table
Select Top 1 * From Emp Order By NEWID()
--Or
Select * From Emp Order By NEWID()In this code snippet, I write the query for getting the random rows from SQL Server table.
