I usually use
DESCRIBE to get a description of a table, or a query. But, I was recently looking up some information on how to interpret the output of a
DESCRIBE SELECT ... statement, and found that all the tutorials used
EXPLAIN rather than
I found in the MySQL docs, this explanation:
EXPLAINstatements are synonyms. In practice, the
DESCRIBEkeyword is more often used to obtain information about table structure, whereas
EXPLAINis used to obtain a query execution plan (that is, an explanation of how MySQL would execute a query).
The following discussion uses the
EXPLAINkeywords in accordance with those uses, but the MySQL parser treats them as completely synonymous.
So, I'm curious why there are two separate commands. Is this needed to conform to the ANSI SQL spec, or is there a historic reason for the two separate commands?