The query:
Explain SELECT * FROM TABLE WHERE 1 = 2
Displays the field names of the given table. Can anyone explain this syntax?
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EXPLAIN is MySQL Utility Statement
The
EXPLAINstatement can be used either as a way to obtain information about how MySQL executes a statement.When you precede a
SELECTstatement with the keywordEXPLAIN, MySQL displays information from the optimizer about the query execution plan. That is, MySQL explains how it would process the statement, including information about how tables are joined and in which order.In short, EXPLAIN statement is used to investigate how MySQL is executing the query.
Your statement generates following output –
As you can see under column
Extrait is returningImpossible WHEREtext. It means that MySQL has identified that it will result in zero rows.Likewise other columns will help you to identify INDEXES being used and other useful information.
For more information please refer – EXPLAIN Syntax