Database: course_teach

Question: How many teachers are there?
SQL: SELECT count(*) FROM teacher

Question: List the names of teachers in ascending order of age.
SQL: SELECT Name FROM teacher ORDER BY Age ASC

Question: What are the age and hometown of teachers?
SQL: SELECT Age ,  Hometown FROM teacher

Question: List the name of teachers whose hometown is not "Little Lever Urban District".
SQL: SELECT Name FROM teacher WHERE Hometown != "Little Lever Urban Distric"

Question: Show the name of teachers aged either 32 or 33?
SQL: SELECT Name FROM teacher WHERE Age  =  32 OR Age  =  33

Question: What is the hometown of the youngest teacher?
SQL: SELECT Hometown FROM teacher ORDER BY Age ASC LIMIT 1

Question: Show different hometown of teachers and the number of teachers from each hometown.
SQL: SELECT Hometown ,  COUNT(*) FROM teacher GROUP BY Hometown

Question: List the most common hometown of teachers.
SQL: SELECT Hometown FROM teacher GROUP BY Hometown ORDER BY COUNT(*) DESC LIMIT 1

Question: Show the hometowns shared by at least two teachers.
SQL: SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*)  >=  2

Question: Show names of teachers and the courses they are arranged to teach.
SQL: SELECT T3.Name ,  T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID  =  T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID  =  T3.Teacher_ID

Question: Show names of teachers and the courses they are arranged to teach in ascending alphabetical order of the teacher's name.
SQL: SELECT T3.Name ,  T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID  =  T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID  =  T3.Teacher_ID ORDER BY T3.Name

Question: Show the name of the teacher for the math course.
SQL: SELECT T3.Name FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID  =  T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID  =  T3.Teacher_ID WHERE T2.Course  =  "Math"

Question: Show names of teachers and the number of courses they teach.
SQL: SELECT T2.Name ,  COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID  =  T2.Teacher_ID GROUP BY T2.Name

Question: Show names of teachers that teach at least two courses.
SQL: SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID  =  T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*)  >=  2