Linked Questions

14 votes
3 answers

Why is SSMS inserting new rows at the top of a table not the bottom?

Whenever I manually insert a row into a table in SQL Server Management Studio 2008 (the database is SQL Server 2005) my new row appears at the TOP of the list rather than the bottom. I'm using ...
Ben Brocka's user avatar
  • 2,063
8 votes
1 answer

Storage order vs Result order

This is a spin-off question from Sort order specified in primary key, yet sorting is executed on SELECT. @Catcall says this on the subject of storage order (clustered index) and the output order A ...
m__'s user avatar
  • 529
7 votes
4 answers

Does an IOT guarantee order in a select?

We need to add a priority column to a table that gets hit about 250 times a second, approx 170 selects, 125 inserts and 60 updates. The column will be a simple number(1). The priority does not matter ...
Ben's user avatar
  • 462
3 votes
3 answers

MySQL: ORDER BY useless?

CREATE TEMPORARY TABLE tt; INSERT INTO tt; many times SELECT FROM tt ORDER BY id LIMIT ?,1000; The temp table is created at the beginning of the script having an "id" auto_increment column (and ...
Sebastian's user avatar
  • 197
2 votes
1 answer

What is the order when SELECT-ing unordered set from an ordered SELECT?

What does the SQL standard and its mainstream DB implementations (SQL Server, Oracle, DB2, PostgreSQL, Firebird, MySQL, etc.) say about the final order in the following general case: SELECT * FROM (...
aoven's user avatar
  • 169
2 votes
1 answer

weird sql server behavior when inserting and selecting

Today after one of the drives on our sql server ran out of space. The drive contained eventracker logs, so I didn't think it was a big deal, but then I noticed when I insert a record into a database, ...
Max Marchevsky's user avatar
2 votes
1 answer

MySQL not using PRIMARY KEY to sort by default [duplicate]

I have a large MySQL table on 5.6.35-81.0 Percona Server with gaps in the PRIMARY key. The table has around 53 Million records and the auto-increment key is now at around 370 million. The table is a ...
NBhatti's user avatar
  • 203
1 vote
2 answers

How to store table values in order [duplicate]

I created a table and inserted values into it but they are not storing in orderly manner. The table looks like: I can order them by using ORDER BY but it does not change them permanently. Is there a ...
dvr's user avatar
  • 11
1 vote
1 answer

Set in mySQL a predefined order for SELECT queries without using the ORDER BY clause

I have a MySQL database and users access it through an old legacy software (OLS) the company bought years ago. OLS connects to MySQL through MySQL ODBC driver. There is no way to change OLS in recent ...
Giorgio R's user avatar
1 vote
2 answers

JSON_AGG automatically sorting data

On running the below query data coming from JSON_AGG gets automatically sorted. But I do not want to sort data. What can I do ? select,, r.description, STRING_AGG(...
Alok007's user avatar
  • 11
0 votes
3 answers

Does MySQL have an "order" type that enforces data integrity? Or does any database support this?

Web dev here, typical scenario at work - I have a list of items that can be reordered using an UI. Upon reordering, I want the database to update. Using MySQL I've always found this process very ...
Nick Manning's user avatar
0 votes
1 answer

Why does my LIMITed SELECT fetch the last record of the table, not the first?

I read that to fetch the first table record, you may use LIMIT 1. I tried to apply that knowledge to my JOIN statement and got a diametrically opposite result. It joined the last record of the joined ...
Sergey Zolotarev's user avatar
0 votes
1 answer

MySQL 8 can view be deterministic view? [duplicate]

I made a huge jump from MySQL 5.7 to MySQL 8 NDB. and it seems to me that in the earlier version when I queried a view I got answers more deterministic than now. Seems like it was ordered by something ...
Rait's user avatar
  • 47
-5 votes
3 answers

Does "deprecated" in MySQL means "not guaranteed" or "still guaranteed"?

MySQL 3.23/4.0/4.1 and 5.1 states: If you use GROUP BY [ for select ], output rows are sorted according to the GROUP BY columns as if you had an ORDER BY for the same columns. ➫➫➫ However, MySQL 5....
Pacerier's user avatar
  • 491