Home >Database >Mysql Tutorial >Why does mysql show that it is invalid?
Mysql displays invalid reasons and solutions: 1. Add indexes to all columns in the or condition; 2. Like queries starting with "%" cannot use indexes; 3. Implicit conversion will cause The index is invalid; 4. The query condition uses a function on the index list or uses operators such as "+-" on the index column.
Recommended: "mysql video tutorial"
Several situations of mysql failure
1 . If there is or in the query condition, even if the query condition contains an index, it will be invalid. If you want to use or, but do not want the index to be invalid, you can only add indexes to all columns in the or condition
2. Like queries do not use indexes at the beginning of 1%,
3. Implicit conversion will invalidate the index
For example, if the field type is varchar and indexed, but the type passed is a numeric type, this The index will be invalid. On the contrary, if the field type is int and the value passed is varchar, it will not affect the index.
4. Query conditions use functions on the index list, or use operators such as +- on the index column. , will also be invalid
5. To be continued. . . .
The above is the detailed content of Why does mysql show that it is invalid?. For more information, please follow other related articles on the PHP Chinese website!