-1

When for example use flat files, and i add data, the data add and i can show in the loop, but also i can rewrite the data and change position inside flat file, for example :

Position 0 : Data_1 Position 1 : Data_2 Position 2 : Data_3 Position 3 : Data_4 Position 4 : Data_5

In MySQL i see the same, add data and you can show as order by ID, Nmae or other values you can order inside MySQL table, but also i can update for example ID Col and order data by ID.

But my question it´s about if it´s possible change the order inside Table for MySQL, as in the other example with Flat file we can see the data it´s storage when save and in MySQL also it´s the same but in MySQL i don´t know if it´s possible change this for show for example as in Flat Files and don´t use other things

For example if in PhpMyAdmin i see my values as this :

Position 0 : Data_1
Position 1 : Data_2
Position 2 : Data_3
Position 3 : Data_4
Position 4 : Data_5

** How Change for see and show as this :**

Position 0 : Data_3
Position 1 : Data_2
Position 2 : Data_1
Position 3 : Data_5
Position 4 : Data_4

As you can see the internal order it´s the same but rows position change in internal mode, and don´t need order By ID, etc.

This it´s my question, if it´s possible re order internal positions and don´t use order by Id, name or other values i use in the Table.

Fran
  • 1
  • 4
  • 1
    no you can't if you want an order make an index – nbk Feb 14 '22 at 20:08
  • 2
    No, the internal order of the data is not visible to applications. – Barmar Feb 14 '22 at 20:08
  • The database would have no concept of what it's supposed to order by if it wasn't by a column in the table. – parttimeturtle Feb 14 '22 at 20:08
  • If i don´t select order by id, etc, show me the order of storage in the table , by this my question if this internal order storage the date as rows can change this internal order storage as in the flat files for example – Fran Feb 14 '22 at 20:17
  • 1
    [This](https://dba.stackexchange.com/a/6053/8542) and [this](https://stackoverflow.com/a/8746712/231316) are relevant reads. – Chris Haas Feb 14 '22 at 20:33
  • 1
    The only method which provides definite rows ordering is explicit ORDER BY clause in the query which retrieves the data. – Akina Feb 14 '22 at 20:35
  • [DEMO fiddle](https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=511be0b535c0197cb2ce55f3a6deeb22). Simple index creation alters the rows ordering output by the query without ORDER BY clause. – Akina Feb 14 '22 at 20:39

1 Answers1

1

...my question it´s about if it´s possible change the order inside Table for MySQL...

No. In relational databases, table rows do not have an inherent ordering. Tables are different from Excel sheets or flat files in that sense.

In the absence of an ORDER BY clause, the engine may retrieve the rows in any order. Moreover, this ordering may change over time without notice.

The Impaler
  • 45,731
  • 9
  • 39
  • 76