Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


select top 5 * from emp order by newid()

my question is , how this query get executed?

Answers were Sorted based on User's Feedback



select top 5 * from emp order by newid() my question is , how this query get executed?..

Answer / kb

Random 5 rows are selected when newid() is used.

Is This Answer Correct ?    12 Yes 0 No

select top 5 * from emp order by newid() my question is , how this query get executed?..

Answer / ankita bosamiya

first of all order by clause will be executed that is first
it will be arranged as ascending or descending order and
than first 5 records will be fatched.....

Is This Answer Correct ?    1 Yes 0 No

select top 5 * from emp order by newid() my question is , how this query get executed?..

Answer / anil sharma

newid() function return random row and top 5 return top 5
rows.
So query return top 5 row using random order.

Is This Answer Correct ?    2 Yes 1 No

select top 5 * from emp order by newid() my question is , how this query get executed?..

Answer / sanjeev kumar

newid() used with uniqueidentifier data types in a table
and uniqueidentifier datatype is used to insert randomly
new number, so the above query will give top 5 records in
randomly manner.

Is This Answer Correct ?    1 Yes 1 No

select top 5 * from emp order by newid() my question is , how this query get executed?..

Answer / praveen n h

SQL server will execute the query in following way...

Select All top 5 rows which are created in the table from
the time it is created.

reason: newid is the key given to each row regardless of
the values that goes into the row of the table.

For example.
if you have created a table temp
and inserted 10 rows, Only fives rows which are created
first will be listed.

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More SQL Server Interview Questions

What is it unwise to create wide clustered index keys?

0 Answers  


What is raid? : SQL Server Architecture

0 Answers  


How you can find out if an index is useful to the optimizer?

0 Answers  


What is a ddl statement?

0 Answers  


statement (of account) Receive ID_receive Date_receive Amount_receive TO_receive From_receive Description_receive 1 2010/01/01 500 Bank Ahmed Payment from the account 2 2010/02/01 700 Bank Ahmed Payment from the account Payment ID_payment Date_payment Amount_payment From_payment To_payment Description_payment 1 2010/03/01 1000 Ahmed Sales Sale goods 2 2010/04/01 1500 Ahmed Sales Sale goods How can crate Stored Procedures for the statement (of account) from these tables? I want statement (of account) like this: (in sql 2005) ID_ name description debit account credit account balance

1 Answers  


What is a result set object returned by mssql_query()?

0 Answers  


Explain triggers in sql?

0 Answers  


How to Display, Amount of Disk Activity Generated by Transact-SQL Statements?

1 Answers  


What is logshipping and its purpose?

0 Answers  


How to list all triggers in the database with sys.triggers in ms sql server?

0 Answers  


What do you mean by sql server agent?

0 Answers  


What is oltp (online transaction processing)?

0 Answers  


Categories