Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2007-03-14 : 02:54:18
|
| Hi All,How are rows ordered in Database? When we delete Top 10 from a table, which rows gets deleted?(I believe the database is based on the relational algebra, where there is no particular ordering of elements(rows))Please correct if I am wrong,Thanks,Prakash.P |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-14 : 02:58:02
|
| Do the SQL Server even accept a DELETE TOP 10 syntax?Peter LarssonHelsingborg, Sweden |
 |
|
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2007-03-14 : 03:02:39
|
| SQL 2005 (T-SQL 2005) does accept the Top clause with insert, update and delete.Thanks,Prakash.P |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-14 : 03:25:44
|
| Ok.I missed the fact that the number of records to be deleted should be enclosed with paranthesis.Peter LarssonHelsingborg, Sweden |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-03-14 : 04:44:41
|
| "I believe the database is based on the relational algebra, where there is no particular ordering of elements(rows))"Correct, unless you explicitly have an ORDER BY clause there is no implied order - and SQL Server may return the rows in a different order [if the same query is repeated]Kristen |
 |
|
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2007-03-14 : 05:06:34
|
| Thank you,That answers my question |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2007-03-14 : 13:10:53
|
quote: Originally posted by Kristen "I believe the database is based on the relational algebra, where there is no particular ordering of elements(rows))"Correct, unless you explicitly have an ORDER BY clause there is no implied order - and SQL Server may return the rows in a different order [if the same query is repeated]Kristen
ah, true, but the data is phyically ordered by the clustering index, until you get to page splits or new pages....Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-03-14 : 15:46:44
|
| ... or there is some data already cached that SQL Server chooses to give you first, whilst its collecting the remainder of the data from Disk ... or so I have been led to believe!Kristen |
 |
|
|
|
|
|
|
|