快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

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://6mz.cn/article/gcsgcg.html

其他资讯