1: query database dbName how many tables
Select COUNT (*) from information_schema.tables where table_schema= ' dbName ';
2: Merge tables based on a field
Select Id,name,sum (operate) from test group by name;
Execution Result:
3: Use an SQL statement to find out the names of students who have more than one class per course
Select name from table group by name have min (Fenshu) >80
4: Delete the same student redundancy information except auto-numbering
Delete tablename whereAuto NumberingNot in (select min (Auto Numbering) from TableName group bySchool Number,name,Course Number,Course Name,score)
The student table is as follows :
AutoNumber number name Course number Course name score
1 2005001 Zhang San 0001 Mathematics 69
2 2005002 John Doe 0001 Mathematics 89
3 2005001 Zhang San 0001 math
SQL Statement Summary "constantly updated"