Oracle Learning (vi) Some problems needing attention in the table query

Source: Internet
Author: User

1. When you use the Where, group BY, and having clauses in a SELECT statement, they function and execute in the following order:

(1) Where is used to filter the data object specified by from

(2) Group by for grouping the results of the Where

(3) is used to filter the data after group by grouping

2, the difference between count (*) and COUNT (Columnname|columnindex):

COUNT (*) is counted as null in the table, and Count (Columnname|columnindex) ignores the null record for the corresponding field.

3. There are four main types of connections specified by the JOIN keyword: INNER join, left outer join, right outer join, and full outer join.

(1) Inner JOIN is an internal connection, is the system default connection, you can omit the inner, it will all meet the conditions of the records listed.

(2) A LEFT outer join is an outer join, in which outer can be omitted, which includes all the rows of the left table in addition to the records that satisfy the criteria.

(3) Right outer join is a right-hand outer join in which outer can be omitted, except to list all the records that meet the criteria, including all rows of the right table.

(4) The full outer join is an all outer join in which outer can be omitted, which includes all the rows of the left table and right tables in addition to the records that satisfy the criteria.

4, the Union clause in select

Use the Union clause to combine two or more query results into one result set. The syntax format is as follows:

(query expression) union [all] (query expression) [union [all] (query expression)]

--use keyword all to indicate that all rows are included in the merged result set, that duplicate rows are not removed, and duplicates are removed without using the ALL keyword.

The basic rules for using Union are:

(1) The number of columns and the order of columns must be the same in all queries

(2) The data type of the corresponding column must be compatible

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.