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
What is a linked server in sql server?
Can group by be used without aggregate functions?
What is set nocount on and what is set nocount off?
What are the different ways you can create databases in sql server?
What are the differences between decimal and float in ms sql server?
What is after dml trigger?
Explain the etl (extraction, transformation, and loading)?
What is “asynchronous” communication in sql server service broker?
What is the datatype of rowid?
What is #temp and @table variable in SQL server?
What is the difference between MVC and Teir Architecher? Plz explain with Layyered Programming example...? Thanks
Explain the difference between primary keys and foreign keys?
How can I create a report based on a query? : sql server management studio
When would you prefer to have a minimum number of indexes?
How to backup SQL Server Reporting Services ?