The statement to query data in MySQL is the SELECT statement, which is used to retrieve specified row and column data from the table. The syntax is: SELECT column_list FROM table_name [WHERE condition] [GROUP BY group_by_column] [HAVING condition] [ORDER BY order_by_column]. The SELECT * query retrieves all columns in the table, while the SELECT column_list retrieves specified columns. You can use the WHERE clause to filter the results, and use the GROUP B
MySQL statement to query data
MySQL to query data. The statement is a SELECT
statement. It is used to retrieve specified row and column data from a database table.
Syntax
<code>SELECT column_list FROM table_name [WHERE condition] [GROUP BY group_by_column] [HAVING condition] [ORDER BY order_by_column]</code>
Elements
Example
<code class="sql">SELECT name, email FROM users;</code>
This query retrieves name
and email## from the
users table # all rows of column.
<code class="sql">SELECT name, email FROM users WHERE age > 18;</code>
users table for which
age is greater than 18.
Other Notes
The query retrieves all columns in the table.
.
,
COUNT(),
AVG()) to calculate the results.
The above is the detailed content of What is the statement to query data in mysql. For more information, please follow other related articles on the PHP Chinese website!