For example ,I have a table represents all teachers in my school including his/her name , sex and the class he/she belongs to.I want to know , for each class, how many males and how many females teachers in a SQL statement.
Abosolutely , each teacher can only belong to one class!
COLUMN TYPE DESCRIPTION
CLASS NUMBER the class number,e.g. 0,1,2,3 ...
SEX NUMBER teacher sex, 0 represents male and 1 represents female.
TEACHER VARCHAR teacher name like Lily,Lucy
More deep:
I have a table represents all teachers in my school including his/her name , age and the class he/she belongs to.I want to know , for each class, how many teachers are younger than 20 and how many teachers are older that 20 at the same time in a SQL statement.
COLUMN TYPE DESCRIPTION
CLASS NUMBER the class number,e.g. 0,1,2,3 ...
AGE NUMBER teacher ages.
TEACHER VARCHAR teacher name like Lily,Lucy