Fuzzy queries are often used when we develop database applications. What if the same condition needs to match many fields? Generally, ProgramEvery field is "field like % cond %" in SQL. In this way, SQL statements will grow astonishing, and even complex SQL statements will be refused to be executed by the database because of the excessive length.
In fact, this problem can be easily solved as long as you use your brains:
First, connect fields that match the same conditions (field1 + field2 +...) into a long string;
Then like "% cond %.
However, there is a problem with this method, that is, it is necessary to weigh the efficiency caused by multi-table join. In general, fields in a single table must be connected and then unified like judgment; For fields between tables, you must filter the fields before implementing this policy.
This policy can not only shorten SQL statements, but also effectively improve SQL Execution efficiency.