Home > Article > Daily Programming > The meaning of asterisk in mysql
The asterisk (*) is a wildcard character in MySQL and has the following meanings: Select all columns: In a SELECT statement, it selects all columns from the specified table. Match any sequence of characters: In the WHERE clause, it is used to match any sequence of characters, such as finding rows containing "John". Fuzzy queries: It can also be used for fuzzy queries, such as finding rows starting with "Jo".
The meaning of asterisk (*) in MySQL
The asterisk (*) is a wildcard character in MySQL, used to match any sequence of characters.
Detailed description:
<code class="sql">SELECT * FROM table_name;</code>
<code class="sql">SELECT * FROM table_name WHERE name LIKE '%John%';</code>
<code class="sql">SELECT * FROM table_name WHERE name LIKE 'Jo%';</code>
Example:
Suppose there is a table named customers, It contains the following columns:
The following query uses asterisks Select all columns from the customers table:
<code class="sql">SELECT * FROM customers;</code>
The following query finds all rows that contain "Smith" in the name column:
<code class="sql">SELECT * FROM customers WHERE name LIKE '%Smith%';</code>
The following query finds all rows that begin with "123" in the address column :
<code class="sql">SELECT * FROM customers WHERE address LIKE '123%';</code>
The above is the detailed content of The meaning of asterisk in mysql. For more information, please follow other related articles on the PHP Chinese website!