The "_" wildcard function is basically the same as the "%" wildcard, except that it only represents the match of any one word Fu, and of course, to indicate a match of two characters, you need to use two "_" wildcard characters,
The "_" is used only if the user determines the number of strings to query, but does not determine the exact value of one or more of the characters.
Example: Using the "_" wildcard to query a course with a class name of 5 words and start with "computer"
In the course table, for information about the names (CNAME), number of people (Scount), and time of Exam (ctest) for all courses that begin with "computer" and have only 5 words
Select Cname,scount,ctest from course where cname like ' computer _ ' ORDER by CNAME
2:
Similar to the "%" wildcard, the "_" wildcard can be used anywhere in the string, and, of course, the "_" wildcard can be used if the user knows only the number of strings to query and not the character of any of them.
Instance:
Use the "_" wildcard to query all courses with a course name of 6 words
In the course table, all courses named 6 characters are queried for the course name (CNAME), the number of people (Scount), and the time of the exam (ctest) information. Instance code:
Select CNAME, scount,ctest from course where cname like ' ___ ' ORDER by CNAME
At this point, it will be found that not only the course name 6 words of all courses, and the course name is less than 6 words of the record is included in the query results table, which is also in the actual application will be ignored, such as the query string "Computer _", if there is a record as "computer", it is also considered to be eligible so the
Select CNAME, scount,ctest from course where cname like ' ____ ' not cname like ' ___ ' ORDER by CNAME
"_" wildcard characters in SQL