2

So I have a simple database with a table that has multiple column, most of which are of string type, one of which is a Boolean type.

My problem occurs when I update a row changing the boolean state, the database re-organizes its self to let the values with a false state be first and the values with the true state to be last in the table.

Is there a way to tell the table not to order the table either while each row is being updated or while the actual table is being created?

Thanks again!

Sammy Guergachi
  • 1,986
  • 4
  • 26
  • 52

1 Answers1

2

In SQL databases, the order of rows within a table is usually undefined. So if you run a query such as

SELECT * FROM TEST

then the database engine may return the rows in any order. If you want to order the rows, you need to use ORDER BY:

SELECT * FROM TEST ORDER BY NAME
Thomas Mueller
  • 48,905
  • 14
  • 116
  • 132