资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

MySQL之SELECT

下面是连接MySQL后,获取的SELECT 语句的帮助:

创新互联长期为上千客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为大荔企业提供专业的网站设计、成都网站建设,大荔网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制开发。

mysql> HELP SELECT
Name: 'SELECT
Description://描述
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, and
can 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 to
any table.
URL: http://dev.mysql.com/doc/refman/5.5/en/select.html

接下来我们一起看一下,SELECT 语句的一些参数和用法:
SELECT ->本意: 即为 选择、挑选;

[ALL | DISTINCT | DISTINCTROW ]

All:所有(默认);
DISTINCT:独特的,显示不同的;
DISTINCTROW:显示不同的行;
mysql> SELECT [DISTINCT/DISTINCTROW] column_name FROM table_name;
ALL参数为默认的参数,而DISTINCT/DISTINCTROW为可选的参数,上面的语句执行后,即可显示table_name表的column_name 中不同的元素,如果把column_name 改成 * 即为选择全部,而再加上,这些参数,意思即为选择不一样的行,而且在这里DISTINCT/DISTINCTROW没有区别。

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

标题名称:MySQL之SELECT
文章源于:http://www.cdkjz.cn/article/gcsgcg.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220