Home > Article > Daily Programming > What does % represent in mysql
The percent symbol % in MySQL is a wildcard character used to match any number of characters in a string. It can be placed at the beginning, end, or middle to find strings that contain, begin, or end the specified character pattern. In addition to %, MySQL supports other wildcard characters such as underscore _ and square brackets [set].
The meaning of % in MySQL
In MySQL, the % symbol represents a wildcard character, which is used in strings Matches any number of characters.
Usage of wildcard characters
% symbol can be placed at the beginning, end, or middle of a string query to match various character patterns:
Example
Here are some examples of MySQL queries using the % wildcard:
Find the query containing All user names for "John":
<code class="sql">SELECT username FROM users WHERE username LIKE '%John%';</code>
Find all tables starting with "admin":
<code class="sql">SHOW TABLES LIKE 'admin%';</code>
Find all fields that contain "customer" but end with "cust":
<code class="sql">SELECT column_name FROM information_schema.columns WHERE column_name LIKE '%customer' AND column_name LIKE 'cust%';</code>
Other wildcards
In addition to %, MySQL also supports other wildcard characters:
Notes
The above is the detailed content of What does % represent in mysql. For more information, please follow other related articles on the PHP Chinese website!