select top 5 * from emp order by newid()

my question is , how this query get executed?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe in brief system database.

544


What are the differences between substr and charindex in sql server.

497


1.how to find the dead lock in sql server? 2.How to fine the memory leaks in sql server? 3.suppose transaction log file increasing what action will take ?

1554


Define synonym?

729


What is the report model project?

103






What is the definition for sql server 2000?

590


Explain for xml explicit mode?

566


Why union all is faster than union?

510


Can we shrink data file in sql server?

539


What is a data source file?

499


How do I start sql server 2016?

525


How to replace the Query Result 'Null Value' with a text ?

562


How to enable/disable indexes?

592


Does sql server use t sql?

525


What is policy based management (pbm)? : sql server database administration

585