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
you have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation? : Sql server administration
How to apply cascading referential integrity in place of triggers?
What is the difference between join and inner join?
What is a print index?
what authentication modes does sql server support? : Sql server database administration
define and explain the differences between clustered and non-clustered indexes.
How will you optimize a stored procedure optimization?
How to use clusters?
How to create a local temporary stored procedure?
Please explain go command in sql server?
What is NOT NULL Constraint in sql server 2012?
What is the architecture of ms sql reporting service?
Help!!!!!!!!!!!! My database has gone offline, it is highlighted as 'Suspect'. Foolishly, i haven't got a recent back up. Is there a way of quickly restoring the database? Thank you
How to use "if ... Else if ... Else ..." Statement structures in ms sql server?
What is difference between createstatement and preparedstatement?