1 / 13

TEAM14 General format of SELECT statement

TEAM14 General format of SELECT statement. head :林志平 Members :陈海洪 朱小明 龚云冰 曹兴 孙源斌. 3.3.6 General format of SELECT statement. SELECT [ALL|DISTINCT]

alair
Download Presentation

TEAM14 General format of SELECT statement

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TEAM14General format of SELECT statement head :林志平 Members :陈海洪 朱小明 龚云冰 曹兴 孙源斌

  2. 3.3.6 General format of SELECT statement SELECT [ALL|DISTINCT] < Out goals expression > [alias ] [ ,< Out goals expression > [alias ]] … FROM <Table or view name> [alias] [ ,< Table or view name > [alias]] … [WHERE <conditional expression >] [GROUP BY <column name 1>[HAVING< conditional expression >] ]... [HAVING < conditional expression >]] [ORDER BY < column name 2> [ASC|DESC] ];

  3. ALL | DIATINCT: ALL inquiries to satisfy all conditions-byte; DIATINCT said that the elimination of duplicate tuple; • FROM: clause to be designated for the query data sources, that is, table or view name; • WHERE: clause for the query that data to meet the conditions of access; • GROUP BY: clause for the results of the group; • ORDER BY: clause for the sort of results, ASC, said ascending, DESC descending said.

  4. The whole meaning of the SELECT statement is based on the WHERE clause of the conditions of expression, from the FROM clause specified in the basic view or to find out the conditions to meet the meta-group, and then SELECT clause in the expression of the target set out to elect yuan The group formed a list of property value, results in the table can be grouped and sorted.

  5. Out goals expression • 1.Out goals expression format (1) * (2) <table name >. * (3) COUNT([DISTINCT|ALL]*) (4) [<table name >.]<Attribute listed expression>[,[< table name >.]< Attribute listed expression >] … One, <Attribute names expression>: By the Attribute column , in the role of the attributes set out the function of the constant and arbitrary arithmetic operations (+,-,*,/) composition of the formula for computing.

  6. 2.Set function format page:98 COUNT SUM AVG ([DISTINCT|ALL] < column name>) MAX MIN COUNT ([DISTINCT|ALL] *)

  7. SQL in the WHERE and HAVING difference??? • HAVING clause enables us to filter into the group after the data, WHERE clause in the aggregate prior to screening records. That is to say in the role of the GROUP BY and HAVING clause before the clause; and HAVING clause in the aggregate after the group recorded Screen.

  8. SELECT region, SUM(population), SUM(area)FROM bbcGROUP BY regionHAVING SUM(population)>1000000

  9. 3.Conditional expression format:the conditions where clause expression (1) < Attribute column name > <Attribute column name >θ <Constant > [ANY|ALL] (SELECT statement)

  10. 条件表达式格式 (3) (<value 1>[,<value 2> ] …) < Attribute column name> [NOT] IN (SELECT statement)

  11. 条件表达式格式 (4) < Attribute column name > [NOT] LIKE <Match string > (5) < Attribute column name > IS [NOT] NULL (6) [NOT] EXISTS (SELECT statement)

  12. 条件表达式格式 (7) AND <Conditional expression > <Conditional expression > or AND <Conditional expression > … OR

  13. That’s all what I say,thanks! Pursue Thank you very much

More Related