In MySQL, when using the IN operator, can we ask MySQL to return the result set (record set) in the same order as the IN set?
Explanation: Suppose we have a table items (item_id, item_name);
and request:
select * from items where item_id in (1,3,5,7,2,4,6,8);
can we set the result (recordset) where the records are in the same order as the IN operator. i 1,3,5,7,2,4,6,8 of record_id s
This is not true; MySQL seems to optimize the search and give a default order (the same as the order of these records stored in the File System).
source share