A function is a keyword in SQL that is used to manipulate the data in a field. A function is a command, usually used in conjunction with a field name or an expression, to process the input data and produce a result
Common functions
Control functions |
String functions |
Mathematical functions |
Date-time functions |
Summary functions |
Case |
SUBSTRING |
Abs |
DATEDIFF |
Avg |
IF |
Left |
Floor |
Date_add |
COUNT |
Nullif |
LENGTH |
RAND |
Str_to_date |
MAX |
Ifnull |
LOWER |
|
Date_format |
MIN |
|
REPLACE |
|
|
SUM |
|
Concat |
|
|
|
|
|
|
|
|
1. Left connection
The left table is the main query data
2. Right connection
The right-hand table is the main query data
3. Internal connection
A typical connection operation, using a comparison operator like = or <>. Includes both equal and natural connections.
An inner join uses a comparison operator to match rows in two tables based on the values of the columns that are common to each table.
Left connection
The result set for the left join includes all rows from the left table specified in the IEFT clause, not just the rows that match the joined columns. If a row in the left table does not have a matching row in the right table, all select list columns in the right table in the associated result set row are null values.
Left JOIN
Select A.* , B.* from A leftjoinon= B.colname
Right connection
The right connection is the reverse connection of the left connection. All rows of the right table will be returned. If a row in the right table does not have a matching row in the left table, a null value will be returned for left table.
Right JOIN
Grammar Select A.* , B.*from A right join on = B.colname
Internal connection
Displaying the data associated with two tables is equivalent to asking for the intersection of two sets.
INNER JOIN
Grammar Select A.* , B.* from A innerjoinon= B.colname
Union [All]
The Union operator can combine the results of two or more SELECT statements, with no duplicates. In other words, if the output of a row exists in a query result, then the records of the same row of the other query results will no longer be output. When using the union operator, you must select the same number of fields, the same number of field expressions, the same data type, the same order (but not the same length) in each SELECT statement
If you need not to remove duplicates, add the ALL keyword
MySQL system functions and federated queries