Site icon Parentings

mysql WRONGLY return column names of a table alphabetically [closed]

ok i’m talking about mysql 8 dbms; i have a table named users. below query would return a result set and order of columns are right[i.e in order in which i define columns of this table].

select * from users

but the problem is this one:

SELECT COLUMN_NAME 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'users';

when i execute this, mysql client return column names in alphabetical order which is wrong and i don’t have any idea why this is happening.

anybody has any idea why this is happening?

ok i need add more details; guys the second query is not in my hand and actually is used by laravel; getColumnListing() defined in Builder class also return column names in the wrong order and after that i use my mysql-client to check ordering and use that sql-stmt; so i guess laravel-method mentioned are doing that wrongly in a way but nobody complains so i thought then maybe my mysql config is wrong.

Exit mobile version