I was working with PHP and mysql a table was given and I was given a table to sort which had a enum field
enum('Pending','Acive','INACTIVE');
I did not understand how the table was sorted?
Enumeration Sorting
ENUM values are sorted based on their index numbers, which depend on the order in which the enumeration members were listed in the column specification. For example, 'b' sorts before 'a' for ENUM('b', 'a'). The empty string sorts before nonempty strings, and NULL values sort before all other enumeration values.
To prevent unexpected results when using the ORDER BY clause on an ENUM column, use one of these techniques:
Specify the ENUM list in alphabetic order.
Make sure that the column is sorted lexically rather than by index number by coding ORDER BY CAST(col AS CHAR) or ORDER BY CONCAT(col).
Reference: http://dev.mysql.com/doc/refman/5.6/en/enum.html#enum-sorting