Write in front
Yesterday went to Tsing Lung Gorge to play a day, tired and dog-like. But fortunately, finally counted on the top of the mountain, but also count to Beijing after the conquest of the third mountain. Here also nagging, do the development of this line, nothing or more sports, on their own or very good, nonsense less, or toss toss the SQL statement it.
Series Articles
MySQL CREATE database, create data table
MySQL's select,insert,delete,update
MySQL group By,order by
Count
Count, often used in conjunction with the group BY statement, at this point, you can understand the number of groupings after grouping. Also take the previous data sheet tb_student as an example.
1. Calculate the number of students enrolled on the same day.
Use school;--calculates the number of students enrolled on the same day. Select COUNT (1) as ' count ', date (createdate) as goschooldate from Tb_student Group by date (CreateDate);
MAX
1, the largest ID
1 Use SCHOOL;2 select MAX (id) from tb_student;
Min
1. Minimum ID
Use School;select min (id) from tb_student;
SUM
1. Find out the age of all students and
Use School;select sum (age) from Tb_student;
Avg
1. Average age of all students
Use School;select avg (age) from Tb_student;
Celing
Celing translation comes from the meaning of "ceiling", meaning, regardless of what is behind the decimal point, go upward. Like the upper age average.
Use School;select Ceiling (AVG (age)) from tb_student;
Of course, and the ceiling corresponding to the floor function, of course, it means the opposite.
Floor
Use School;select Floor (AVG (age)) from tb_student;
MySQL's Count,max,min,sum,avg,celing,floor