Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative to column name "order" in MySQL [closed]

Tags:

sql

mysql

When I create a new table that need an ordering defined by the user, my first idea always go to a column name "order". Of course, this is NOT good since it's a reserved word.

Which name are you giving to that column in your database models ?

like image 399
Cyril N. Avatar asked Jan 17 '11 17:01

Cyril N.


People also ask

How do I change column order in MySQL?

When you hover over the table name you would see three icons, click on settings (that is the one in the middle) or you can right-click and select Alter Table , then click on the column and drag it to the position you want your column to be. on your bottom right you will see apply (click and apply🙂).

Does order of columns matter in MySQL?

Yes, column order does matter.

Can I use column in ORDER BY without specifying in select?

In theory, every statement in SQL Server create virtual table passed to next statement. In other words, when FROM and Where clause are finished, next step is SELECt columns from virtual group created step before. But, it is possible to order result set by column that is not listed in select list.


1 Answers

I use "position" in place of "order"

like image 81
CIRCLE Avatar answered Sep 28 '22 10:09

CIRCLE