I was under impression that default order of columns is internal mysql order but for some reason describe table and selecting column_name gives me compleatly different order.
How can I set ORDER BY to be same as in 'describe table' ('default' table order – not by name)?
Server version: 8.0.12 MySQL Community Server - GPL
mysql> describe assetType;
+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+
| assetTypeID | int(11) | NO | PRI | NULL | auto_increment |
| assetName | varchar(45) | YES | | NULL | |
+-------------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
mysql> SELECT column_name FROM information_schema.columns WHERE table_name='assetType';
+-------------+
| COLUMN_NAME |
+-------------+
| assetName |
| assetTypeID |
+-------------+
2 rows in set (0.00 sec)
Best Answer
The field ORDINAL_POSITION is there to help