 | Idx | Table      | Column | Primary Key | Foreign Key | 
 | ----------- | ----------- | ----------- | ----------- | ----------- | 
  | 0 |  | * |   |   | 
 | 1 | **course** | Course_ID | + |   | 
 | 2 |   | Staring_Date |   |   | 
 | 3 |   | Course |   |   | 
 | 4 | **teacher** | Teacher_ID | + |   | 
 | 5 |   | Name |   |   | 
 | 6 |   | Age |   |   | 
 | 7 |   | Hometown |   |   | 
 | 8 | **course_arrange** | Course_ID | + | --> 1 | 
 | 9 |   | Teacher_ID |   | --> 4 | 
 | 10 |   | Grade |   |   | 
 
  | Index | Question  | SQL | gold QDMR | pred QDMR | Exec | SQL hardness |
  | ----------- | ----------- | ----------- |  ----------- | ----------- | ----------- | ----------- | 
 | SPIDER_dev_381 | How many teachers are there? | SELECT count(*) FROM teacher | 1. SELECT[tbl:​teacher] <br>2. AGGREGATE[count, #1] <br> | 1. SELECT[tbl:​teacher] <br>2. AGGREGATE[count, #1] <br> | + | easy | 
  | SPIDER_dev_382 | What is the total count of teachers? | SELECT count(*) FROM teacher | 1. SELECT[tbl:​teacher] <br>2. AGGREGATE[count, #1] <br> | 1. SELECT[tbl:​teacher] <br>2. AGGREGATE[count, #1] <br> | + | easy | 
  | SPIDER_dev_383 | List the names of teachers in ascending order of age. | SELECT Name FROM teacher ORDER BY Age ASC | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​teacher:​Age, #1] <br>4. SORT[#2, #3, sortdir:​ascending] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​teacher:​Age, #1] <br>4. SORT[#2, #3, sortdir:​ascending] <br> | + | easy | 
  | SPIDER_dev_384 | What are the names of the teachers ordered by ascending age? | SELECT Name FROM teacher ORDER BY Age ASC | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​teacher:​Age, #1] <br>4. SORT[#2, #3, sortdir:​ascending] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​teacher:​Age, #1] <br>4. SORT[#2, #3, sortdir:​ascending] <br> | + | easy | 
  | SPIDER_dev_385 | What are the age and hometown of teachers? | SELECT Age ,  Hometown FROM teacher | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Age, #1] <br>3. PROJECT[col:​teacher:​Hometown, #1] <br>4. UNION[#2, #3] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Age, #1] <br>3. PROJECT[col:​teacher:​Hometown, #1] <br>4. UNION[#2, #3] <br> | + | medium | 
  | SPIDER_dev_386 | What is the age and hometown of every teacher? | SELECT Age ,  Hometown FROM teacher | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Age, #1] <br>3. PROJECT[col:​teacher:​Hometown, #1] <br>4. UNION[#2, #3] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Age, #1] <br>3. PROJECT[col:​teacher:​Hometown, #1] <br>4. UNION[#2, #3] <br> | + | medium | 
  | SPIDER_dev_387 | List the name of teachers whose hometown is not `` Little Lever Urban District ''. | select name from teacher where hometown != "little lever urban district" | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Hometown, #1] <br>3. COMPARATIVE[#1, #2, comparative:​!=:​little lever urban district:​col:​teacher:​Hometown] <br>4. PROJECT[col:​teacher:​Name, #3] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Hometown, #1] <br>3. COMPARATIVE[#1, #2, comparative:​!=:​Turton Urban District:​col:​teacher:​Hometown] <br>4. PROJECT[col:​teacher:​Name, #3] <br> | - | easy | 
  | SPIDER_dev_389 | Show the name of teachers aged either 32 or 33? | SELECT Name FROM teacher WHERE Age  =  32 OR Age  =  33 | 1. SELECT[tbl:​teacher] <br>2. FILTER[#1, comparative:​=:​32:​col:​teacher:​Age] <br>3. FILTER[#1, comparative:​=:​33:​col:​teacher:​Age] <br>4. UNION[#2, #3] <br>5. PROJECT[col:​teacher:​Name, #4] <br> | 1. SELECT[tbl:​teacher] <br>2. COMPARATIVE[#1, #1, comparative:​=:​32:​col:​teacher:​Age] <br>3. COMPARATIVE[#1, #1, comparative:​=:​33:​col:​teacher:​Age] <br>4. UNION[#2, #3] <br>5. PROJECT[col:​teacher:​Name, #4] <br> | + | medium | 
  | SPIDER_dev_390 | What are the names of the teachers who are aged either 32 or 33? | SELECT Name FROM teacher WHERE Age  =  32 OR Age  =  33 | 1. SELECT[tbl:​teacher] <br>2. FILTER[#1, comparative:​=:​32:​col:​teacher:​Age] <br>3. FILTER[#1, comparative:​=:​33:​col:​teacher:​Age] <br>4. UNION[#2, #3] <br>5. PROJECT[col:​teacher:​Name, #4] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Age, #1] <br>3. COMPARATIVE[#1, #2, comparative:​=:​32:​col:​teacher:​Age] <br>4. COMPARATIVE[#1, #2, comparative:​=:​33:​col:​teacher:​Age] <br>5. UNION[#3, #4] <br>6. PROJECT[col:​teacher:​Name, #5] <br> | + | medium | 
  | SPIDER_dev_391 | What is the hometown of the youngest teacher? | SELECT Hometown FROM teacher ORDER BY Age ASC LIMIT 1 | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Age, #1] <br>3. SUPERLATIVE[comparative:​min:​None, #1, #2] <br>4. PROJECT[col:​teacher:​Hometown, #3] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Hometown, #1] <br>3. SUPERLATIVE[comparative:​min:​None, #1, #2] <br>4. PROJECT[col:​teacher:​Hometown, #3] <br> | - | medium | 
  | SPIDER_dev_392 | Where is the youngest teacher from? | SELECT Hometown FROM teacher ORDER BY Age ASC LIMIT 1 | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Age, #1] <br>3. SUPERLATIVE[comparative:​min:​None, #1, #2] <br>4. PROJECT[col:​teacher:​Hometown, #3] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Age, #1] <br>3. SUPERLATIVE[comparative:​min:​None, #1, #2] <br> | - | medium | 
  | SPIDER_dev_393 | Show different hometown of teachers and the number of teachers from each hometown. | SELECT Hometown ,  COUNT(*) FROM teacher GROUP BY Hometown | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Hometown, #1] <br>3.*(distinct)* PROJECT[different #REF, #2] <br>4. GROUP[count, #1, #3] <br>5. UNION[#3, #4] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Hometown, #1] <br>3. GROUP[count, #1, #2] <br>4. UNION[#2, #3] <br> | + | medium | 
  | SPIDER_dev_394 | For each hometown, how many teachers are there? | SELECT Hometown ,  COUNT(*) FROM teacher GROUP BY Hometown | 1. SELECT[col:​teacher:​Hometown] <br>2. PROJECT[tbl:​teacher, #1] <br>3. GROUP[count, #2, #1] <br>4. UNION[#1, #3] <br> | 1. SELECT[col:​teacher:​Hometown] <br>2. PROJECT[tbl:​teacher, #1] <br>3. GROUP[count, #2, #1] <br>4. UNION[#1, #3] <br> | + | medium | 
  | SPIDER_dev_395 | List the most common hometown of teachers. | SELECT Hometown FROM teacher GROUP BY Hometown ORDER BY COUNT(*) DESC LIMIT 1 | 1. SELECT[col:​teacher:​Hometown] <br>2. PROJECT[tbl:​teacher, #1] <br>3. GROUP[count, #2, #1] <br>4. SUPERLATIVE[comparative:​max:​None, #1, #3] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Hometown, #1] <br>3. GROUP[count, #1, #2] <br>4. SUPERLATIVE[comparative:​max:​None, #2, #3] <br> | + | hard | 
  | SPIDER_dev_396 | What is the most commmon hometowns for teachers? | SELECT Hometown FROM teacher GROUP BY Hometown ORDER BY COUNT(*) DESC LIMIT 1 | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Hometown, #1] <br>3. GROUP[count, #1, #2] <br>4. SUPERLATIVE[comparative:​max:​None, #2, #3] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Hometown, #1] <br>3. GROUP[count, #1, #2] <br>4. SUPERLATIVE[comparative:​max:​None, #2, #3] <br> | + | hard | 
  | SPIDER_dev_397 | Show the hometowns shared by at least two teachers. | SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*)  >=  2 | 1. SELECT[col:​teacher:​Hometown] <br>2. PROJECT[tbl:​teacher, #1] <br>3. GROUP[count, #2, #1] <br>4. COMPARATIVE[#1, #3, comparative:​>=:​2] <br> | 1. SELECT[col:​teacher:​Hometown] <br>2. PROJECT[tbl:​teacher, #1] <br>3. GROUP[count, #2, #1] <br>4. COMPARATIVE[#1, #3, comparative:​>=:​2] <br> | + | easy | 
  | SPIDER_dev_398 | What are the towns from which at least two teachers come from? | SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*)  >=  2 | 1. SELECT[col:​teacher:​Hometown] <br>2. PROJECT[tbl:​teacher, #1] <br>3. GROUP[count, #2, #1] <br>4. COMPARATIVE[#1, #3, comparative:​>=:​2] <br> | 1. SELECT[col:​teacher:​Hometown] <br>2. PROJECT[tbl:​teacher, #1] <br>3. GROUP[count, #2, #1] <br>4. COMPARATIVE[#1, #3, comparative:​>=:​2] <br> | + | easy | 
  | SPIDER_dev_399 | Show names of teachers and the courses they are arranged to teach. | 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 | 1. SELECT[col:​teacher:​Name] <br>2. PROJECT[col:​course:​Course, #1] <br>3. UNION[#1, #2] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​course:​Course, #1] <br>4. UNION[#2, #3] <br> | + | medium | 
  | SPIDER_dev_400 | What is the name of each teacher and what course they teach? | 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 | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[tbl:​course_arrange, #1] <br>4. PROJECT[col:​course:​Course, #3] <br>5. UNION[#2, #4] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​course:​Course, #1] <br>4. UNION[#2, #3] <br> | + | medium | 
  | SPIDER_dev_401 | Show names of teachers and the courses they are arranged to teach in ascending alphabetical order of the teacher's name. | 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 | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​course:​Course, #1] <br>4. UNION[#2, #3] <br>5. SORT[#4, #2, sortdir:​ascending] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​course:​Course, #1] <br>4. PROJECT[col:​course:​Course, #3] <br>5. UNION[#2, #4] <br>6. SORT[#5, #2, sortdir:​ascending] <br> | + | hard | 
  | SPIDER_dev_402 | What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher? | 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 | 1. SELECT[tbl:​teacher] <br>2. PROJECT[tbl:​course_arrange, #1] <br>3. PROJECT[col:​teacher:​Name, #1] <br>4. PROJECT[col:​course:​Course, #2] <br>5. UNION[#3, #4] <br>6. SORT[#5, #3, sortdir:​ascending] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[tbl:​course_arrange, #1] <br>4. PROJECT[col:​course:​Course, #3] <br>5. UNION[#2, #4] <br>6. SORT[#5, #2, sortdir:​ascending] <br> | + | hard | 
  | SPIDER_dev_403 | Show the name of the teacher for the math course. | 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" | 1. SELECT[tbl:​teacher] <br>2. FILTER[#1, comparative:​=:​Math:​col:​course:​Course] <br>3. PROJECT[col:​teacher:​Name, #2] <br> | 1. SELECT[tbl:​course] <br>2. COMPARATIVE[#1, #1, comparative:​=:​Math:​col:​course:​Course] <br>3. PROJECT[col:​teacher:​Name, #2] <br> | + | hard | 
  | SPIDER_dev_405 | Show names of teachers and the number of courses they teach. | SELECT T2.Name ,  COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID  =  T2.Teacher_ID GROUP BY T2.Name | 1. SELECT[col:​teacher:​Name] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[tbl:​course_arrange, #1] <br>4. GROUP[count, #3, #1] <br>5. UNION[#2, #4] <br> | 1. SELECT[col:​teacher:​Name] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. GROUP[count, #2, #1] <br>4. UNION[#1, #3] <br> | - | medium | 
  | SPIDER_dev_406 | What are the names of the teachers and how many courses do they teach? | SELECT T2.Name ,  COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID  =  T2.Teacher_ID GROUP BY T2.Name | 1. SELECT[col:​teacher:​Name] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[tbl:​course_arrange, #1] <br>4. GROUP[count, #3, #1] <br>5. UNION[#2, #4] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[col:​teacher:​Name, #1] <br>3. PROJECT[col:​course:​Course, #1] <br>4. GROUP[count, #3, #1] <br>5. UNION[#2, #4] <br> | + | medium | 
  | SPIDER_dev_407 | Show names of teachers that teach at least two courses. | 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 | 1. SELECT[tbl:​teacher] <br>2. PROJECT[tbl:​course_arrange, #1] <br>3. GROUP[count, #2, #1] <br>4. COMPARATIVE[#1, #3, comparative:​>=:​2] <br>5. PROJECT[col:​teacher:​Name, #4] <br> | 1. SELECT[col:​teacher:​Name] <br>2. PROJECT[tbl:​course_arrange, #1] <br>3. GROUP[count, #2, #1] <br>4. COMPARATIVE[#1, #3, comparative:​>=:​2] <br> | + | medium | 
  | SPIDER_dev_408 | What are the names of the teachers who teach at least two courses? | 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 | 1. SELECT[tbl:​teacher] <br>2. PROJECT[tbl:​course_arrange, #1] <br>3. GROUP[count, #2, #1] <br>4. COMPARATIVE[#1, #3, comparative:​>=:​2] <br>5. PROJECT[col:​teacher:​Name, #4] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[tbl:​course_arrange, #1] <br>3. GROUP[count, #2, #1] <br>4. COMPARATIVE[#1, #3, comparative:​>=:​2] <br>5. PROJECT[col:​teacher:​Name, #4] <br> | + | medium | 
  | SPIDER_dev_409 | List the names of teachers who have not been arranged to teach courses. | SELECT Name FROM teacher WHERE Teacher_id NOT IN (SELECT Teacher_id FROM course_arrange) | 1. SELECT[tbl:​teacher] <br>2. FILTER[#1, tbl:​course_arrange] <br>3. DISCARD[#1, #2] <br>4. PROJECT[col:​teacher:​Name, #3] <br> | 1. SELECT[tbl:​teacher] <br>2. PROJECT[tbl:​course_arrange, #1] <br>3. COMPARATIVE[#1, #2, comparative:​=:​History:​col:​course:​Course] <br>4. DISCARD[#1, #3] <br>5. PROJECT[col:​teacher:​Name, #4] <br> | - | hard | 
 ***
 Exec acc: **0.8148**
