Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SELECT of MySQL

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following is the help for the SELECT statement obtained after connecting to MySQL:

Mysql > HELP SELECTName: 'SELECTDescription:// describes the Syntax:// syntax SELECT [ALL | DISTINCT | DISTINCTROW] [HIGH_PRIORITY] [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] select_expr [, select_expr...] [FROM table_references [WHERE where_condition] [GROUP BY {col_name | expr | position} [ASC | DESC],... [WITH ROLLUP]] [HAVING where_condition] [ORDER BY {col_name | expr | position} [ASC | DESC],...] [LIMIT {[offset,] row_count | row_count OFFSET offset}] [PROCEDURE procedure_name (argument_list)] [INTO OUTFILE 'file_name' [CHARACTER SET charset_name] export_options | INTO DUMPFILE' file_name' | INTO var_name [, var_name]] [FOR UPDATE | LOCK IN SHARE MODE]] SELECT is used to retrieve rows selected from one or more tables, andcan include UNION statements and subqueries. See [HELP UNION], and http://dev.mysql.com/doc/refman/5.5/en/subqueries.html.The most commonly used clauses of SELECT statements are these:o Each select_expr indicates a column that you want to retrieve. There must be at least one select_expr.o table_references indicates the table or tables from which to retrieve rows. Its syntax is described in [HELP JOIN]. O The WHERE clause, if given, indicates the condition or conditions that rows must satisfy to be selected. Where_condition is an expression that evaluates to true for each row to be selected. The statement selects all rows if there is no WHERE clause. In the WHERE expression, you can use any of the functions and operators that MySQL supports, except for aggregate (summary) functions. See http://dev.mysql.com/doc/refman/5.5/en/expressions.html, and http://dev.mysql.com/doc/refman/5.5/en/functions.html.SELECT can also be used to retrieve rows computed without reference toany table.URL: http://dev.mysql.com/doc/refman/5.5/en/select.html

Next, let's take a look at some parameters and usage of the SELECT statement:

SELECT-> original meaning: to choose or choose.

[ALL | DISTINCT | DISTINCTROW]

All: all (default)

DISTINCT: unique, showing different

DISTINCTROW: displaying different lines

Mysql > SELECT [DISTINCT/DISTINCTROW] column_name FROM table_name

The ALL parameter is the default parameter, and DISTINCT/DISTINCTROW is an optional parameter. After the above statement is executed, you can display different elements in the column_name of the table_name table. If you change column_name to *, you will select all. In addition, these parameters mean to select different rows, and there is no difference in DISTINCT/DISTINCTROW here.

[HIGH_PRIORITY] [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report