Data Insertion, Deletion, Modification#
- Insertion
- Deletion
- Modification
- Query
Simple Query, Join Query#
-
Simple Query
-
Join Query
mysql Union
Tips:
- The "*" symbol can replace fields
- Where contains conditions after it
- Conditions can be connected using AND or OR
- LIMIT can be used to limit the length of the result set
- OFFSET can be used to specify the offset of the result set (where to start)
- COUNT(*) can retrieve the number of rows in the result set
-
Nested Subquery
Sorting, Calculating, Grouping Query Results#
-
Sorting
-
Calculating
Function Description Example AVG Calculate the average value AVG(column_name(s)) COUNT Calculate the total number of query records COUNT(column_name(s)) MAX Calculate the maximum value MAX(column_name(s)) MIN Calculate the minimum value MIN(column_name(s)) SUM Calculate the sum SUM(column_name(s)) MOD Calculate the remainder MOD(column_name(s),value) STD Calculate the standard deviation STD(column_name(s)) RAND Calculate random number RAND() ROUND Calculate rounding ROUND(column_name(s),value) GREATEST Calculate the maximum value GREATEST(column_name(s),column_name(s)) LEAST Calculate the minimum value LEAST(column_name(s),column_name(s)) Tips:
- Difference between Max and Greatest functions
- Standard deviation is the square root of variance