Group queries
Select query information from table name
Where condition
Group By column (multiple, separated)
Order by Sort method
(Query information if the column name and aggregate function appear at the same time, either in an aggregate function or in a group query)
Having conditional grouping filter (usually with group by, position behind)
Where: A row that is used to filter the resulting rows from the operation specified by the FROM clause
GROUP BY: Used to group the WHERE clause output
Having: Used to filter rows from the results of a grouping
1. A group query is a classification of statistics and outputs for different groups in a table
2.having clauses can be filtered again on a group basis
3. Use the order in the SQL statement, Where-->group by-->having
Anatomy:
1.select Query What
2.from from where to query
3.where Column name criteria (fuzzy query, relational expression query)
4.grop by group Query
Aggregation function filtering after 5.haing grouping
Table Connection
Select column from table 1, table 2
Where Condition (table 1. primary key column = Table 2. Foreign key column)
Internal connection (inner join)
Select column from table 1 inner JOIN table 2
On conditions (table 1. primary key column = Table 2. Foreign key column)
As can also assign aliases to tables
Outer JOIN (two Outer connection main table position opposite)
Left OUTER JOIN
Select column
From Main Table
Left OUTER join from table
On (table 1. primary key column = Table 2. Foreign key column)
Right outer join
Select column
From table
Right outer join Main Table
On (table 1. primary key column = Table 2. Foreign key column)
The data in the primary table (left/right table) is matched from the data in the table
1. Match, return to result set
2. No match, null value returned to result set
SQL group queries and connection queries