db_id stringclasses 69
values | schema stringclasses 69
values | m_schema stringclasses 69
values | question stringlengths 24 325 | sql stringlengths 23 804 | evidence stringlengths 0 673 |
|---|---|---|---|---|---|
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What are the names of the courses that the students with the lowest intelligence are least satisfied with? | SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.sat = 1 AND T1.intelligence = 1 | lower intelligence refers to intelligence = 1; sat refers to student's satisfaction degree with the course where least satisfaction refers to sat = 1; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Which of the two courses, "Advanced Operating System" or "Intro to BlockChain', did most of the students receive an A in? | SELECT T2.name FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.name IN ('Advanced Operating System', 'Intro to BlockChain') GROUP BY T2.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1 | A refers to an excellent grade in which grade = 'A'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the popularity of the professor who advises the highest number of students with the highest research ability? | SELECT T2.popularity FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id, T1.capability ORDER BY COUNT(T1.student_id) DESC, T1.capability DESC LIMIT 1 | professor with the highest research ability refers to prof_id where MAX(capability); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the average number of students who registered for the courses with a difficulty of 4? | SELECT CAST(COUNT(T1.student_id) AS REAL) / COUNT(DISTINCT T2.course_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.diff = 4 | diff refers to difficulty; DIVIDE(COUNT(student_id where diff = 4), COUNT(course_id where diff = 4)); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | How many students, who have a GPA between 3 to 4, failed a course? | SELECT COUNT(T2.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade IS NULL AND T1.gpa BETWEEN 3 AND 4 | GPA is an abbreviated name of Grade Point Average where GPA between 3 to 4 refers to gpa BETWEEN 3 AND 4; If grade is null or empty, it means that this student fails to pass this course; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | How many students taking a bachelor's degree received an A in all of the courses that they took? | SELECT COUNT(T2.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade = 'A' AND T1.type = 'UG' | bachelor's degree is an undergraduate degree in which type = 'UG'; A refers to an excellent grade in which grade = 'A'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the average GPA of the students with the highest research capability and high salary? List the full names of the students. | SELECT AVG(T2.gpa), T2.f_name, T2.l_name FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' AND T1.capability = 5 GROUP BY T2.student_id | the highest research capability refers to capability = 5; high salary refers to salary = 'high'; prof_id refers to professor’s ID; GPA is an abbreviated name of Grade Point Average where average GPA refers to AVG(gpa); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | List the professors' IDs and students' IDs with the lowest research ability. | SELECT prof_id, student_id FROM RA WHERE capability = ( SELECT MIN(capability) FROM RA ) | the lowest research ability refers to MIN(capability); professor’s ID refers to prof_id; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Name the professor who got graduation from the University of Boston. | SELECT first_name, last_name FROM prof WHERE graduate_from = 'University of Boston' | Name the professor refers to full name which includes f_name and l_name; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | List the courses' IDs and students' IDs who failed to pass the course. | SELECT course_id, student_id FROM registration WHERE grade IS NULL OR grade = '' | If grade is null or empty, it means that this student fails to pass the course; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the male and female ratio among the professors? | SELECT CAST(SUM(CASE WHEN gender = 'Male' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender = 'Female' THEN 1 ELSE 0 END) FROM prof | DIVIDE(COUNT(prof_id where gender = 'Male'), COUNT(prof_id where gender = 'Female')); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Describe the names and credits of the least difficult courses. | SELECT name, credit FROM course WHERE diff = ( SELECT MIN(diff) FROM course ) | diff refers to difficulty; the least difficult courses refer to MIN(diff); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Describe the students' full names and GPAs under the supervision of the most popular professor. | SELECT T3.f_name, T3.l_name, T3.gpa FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id ORDER BY T1.popularity DESC LIMIT 1 | student's full names = f_name, l_name; most popular refers to MAX(popularity); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Provide the full names and emails of unpaid research assistants. | SELECT T2.f_name, T2.l_name, T2.email FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free' | full names = f_name, l_name; research assistant refers to the student who serves for research where the abbreviation is RA; unpaid research assistant refers to salary = 'free'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | List the research assistants' full names, capabilities and GPAs who were under the supervision of Merwyn Conkay. | SELECT T3.f_name, T3.l_name, T2.capability, T3.gpa FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T1.first_name = 'Merwyn' AND T1.last_name = 'Conkay' | research assistant refers to the student who serves for research where the abbreviation is RA; full names = f_name, l_name; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Describe the students' full names and grades in Intro to BlockChain course. | SELECT T1.f_name, T1.l_name, T2.grade FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Intro to BlockChain' | student's full names = f_name, l_name; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among students registered for the most difficult course, list the students' full names who got grade A. | SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.grade = 'A' ORDER BY T3.diff DESC LIMIT 1 | difficulty refers to diff; most difficult course refers to MAX(diff); student's full names = f_name, l_name; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Describe the full names and graduated universities of the professors who advised Olia Rabier. | SELECT T1.first_name, T1.last_name, T1.graduate_from FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Olia' AND T3.l_name = 'Rabier' | full names of the professors = first_name, last_name; graduated universities of the professors refers to graduate_from; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Name the students of the Advanced Database Systems course with the highest satisfaction. | SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Advanced Database Systems' ORDER BY T2.sat DESC LIMIT 1 | full the students = f_name, l_name; course refers to name; satisfaction refers to sat; highest satisfaction refers to MAX(sat); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Calculate the GPA of the semester for Laughton Antonio. | SELECT CAST(SUM(T3.credit * CASE T1.grade WHEN 'A' THEN 4 WHEN 'B' THEN 3 WHEN 'C' THEN 2 WHEN 'D' THEN 1 ELSE 1 END) AS REAL) / COUNT(T3.credit) FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T2.f_name = 'Laughton' AND T2.l... | GPA of the semester = DIVIDE(SUM(MULTIPLY(credit, grade)), SUM(credit)); grade 'A' refers to gpa = 4; grade 'B' refers to gpa = 3; grade 'C' refers to gpa = 2; grade 'D' refers to gpa = 1; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Provide the registered courses' names by undergraduate students with GPA of 3.7 and above. | SELECT DISTINCT T1.f_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.type = 'UG' AND T1.gpa > 3.7 | Undergraduate students refers to type = 'UG'; GPA of 3.7 and above refers to gpa > 3.7; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Describe the names and capability of the students who were advised by professors from the University of Washington. | SELECT T3.f_name, T3.l_name, T2.capability FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T1.graduate_from = 'University of Washington' | names of the students = f_name, l_name; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Describe the full names, emails and intelligence of the students with the highest capability and salary. | SELECT f_name, l_name, email, intelligence FROM student WHERE student_id IN ( SELECT student_id FROM RA WHERE salary = 'high' AND capability = ( SELECT MAX(capability) FROM RA ) ) | full names of the students = f_name; l_name; highest capability refers to MAX(capability); highest salary refers to salary = 'high'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Mention the names and credits of course registered by the students who were under the supervision of female professor with the highest teaching ability. | SELECT T5.name, T5.credit FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T1.student_id = T3.student_id INNER JOIN registration AS T4 ON T3.student_id = T4.student_id INNER JOIN course AS T5 ON T4.course_id = T5.course_id WHERE T2.gender = 'Female' ORDER BY T2.teachingability ... | female refers to gender = 'Female'; highest teaching ability refers to MAX(teachingability); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | How many of the professors are female? | SELECT COUNT(prof_id) FROM prof WHERE gender = 'Female' | female refers to gender = 'Female'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the name of the most difficult course? | SELECT name FROM course WHERE diff = ( SELECT MAX(diff) FROM course ) | difficulty of a course refers to diff; most difficult course refers to MAX(diff); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among the students with a gpa of 3.1 to 3.7, how many of them are undergraduate students? | SELECT COUNT(student_id) FROM student WHERE gpa BETWEEN 3.1 AND 3.7 AND type = 'UG' | gpa of 3.1 to 3.7 refers to gpa BETWEEN 3.1 AND 3.7; undergraduate students refers to type = 'UG'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the credit of the course named "Computer Vision"? | SELECT credit FROM course WHERE name = 'Computer Vision' | |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Give the student's ID of students with 2.5 GPA and enrolled in C for Programmers. | SELECT T2.student_id FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'C for Programmers' AND T1.gpa = 2.5 | |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Give the student's last name that gave the highest student satisfaction for the course "Intro to Database 2". | SELECT T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Intro to Database 2' ORDER BY T2.sat DESC LIMIT 1 | student's last name refers to l_name; satisfaction refers to sat; highest satisfaction refers to MAX(sat); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among the students with high salary, what is total number of students with a GPA higher than 3? | SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' AND T2.gpa > 3 | high salary refers to salary = 'high'; GPA higher than 3 refers to gpa > 3; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among undergraduate students, list the name of the course with the highest student satisfaction. | SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.type = 'UG' ORDER BY T2.sat DESC LIMIT 1 | Undergraduate students refers to type = 'UG'; satisfaction refers to sat; highest satisfaction refers to MAX(sat); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | List the capability of research postgraduate students with an intellegence level of 4 and above. | SELECT T1.capability FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.type = 'RPG' AND T2.intelligence >= 4 | research postgraduate students refers to type = 'RPG'; intelligence level of 4 and above refers to intelligence > = 4; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | In students with a grade of B, how many of them have an intellegence level of 3? | SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.grade = 'B' AND T2.intelligence = 3 | |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the difficulty of the course in which a student with level of intellengence of 5 got an A grade? | SELECT T3.diff FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.grade = 'A' AND T1.intelligence = 5 | difficulty of the course refers to diff; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among professors with the highest popularity, how many of their students have research capability of 5? | SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T1.capability = 5 ORDER BY T2.popularity DESC LIMIT 1 | highest popularity refers to MAX(popularity); research capability refers to capability; capability = 5; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | List the course's name where students acquired a grade of D. | SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D' | |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the capability on research of the student named Alvera McQuillin? | SELECT T2.capability FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T1.f_name = 'Alvera' AND T1.l_name = 'McQuillin' | capability on research refers to capability; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Of courses with 3 credit, how many students have GPA of 3.2? | SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.credit = 3 AND T1.gpa = 3.2 | |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among students with low salary, how many of them have a gpa of 3.5? | SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa = 3.5 AND T1.salary = 'low' | low salary refers to salary = 'low'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | List the student's email with grade of B in a course with difficulty greater than the 80% of average difficulty of all courses. | SELECT T2.email FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'B' GROUP BY T3.diff HAVING T3.diff > AVG(T3.diff) * 0.8 | difficulty refers to diff; course with difficulty greater than the 80% of average difficulty refers to diff > MULTIPLY(AVG(diff), 80%); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among the professors with a teachability of 3 and below, what is the percentage of their student advisees with a low salary? | SELECT CAST(SUM(CASE WHEN T1.salary = 'low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.salary) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability < 3 | teachability < = 3; percentage = MULTIPLY(DIVIDE(COUNT(salary = 'low'), COUNT(salary)), 1.0); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Find the most important and most difficult courses. | SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course ) | most important refers to MAX(credit); most difficult refers to MAX(diff); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the average teaching ability of the most popular professors? | SELECT CAST(SUM(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof ) | average = AVG(teachingability); most popular professor refers to MAX(popularity); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Calculate the average satisfaction of the good students with their courses. | SELECT CAST(SUM(sat) AS REAL) / COUNT(course_id) FROM registration WHERE grade = 'B' | average satisfaction = DIVIDE(SUM(sat), COUNT(course_id)); satisfaction refers to sat; good student refers to grade = 'B'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among the students with less than four intelligence, list the full name and phone number of students with a greater than 3 GPA. | SELECT f_name, l_name, phone_number FROM student WHERE gpa > 3 AND intelligence < 4 | intelligence < 4; full name = f_name, l_name; gpa > 3; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Name the students with above-average capability. | SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T2.capability > ( SELECT AVG(capability) FROM RA ) | name of the students = f_name, l_name; above average-capability refers to capability > AVG(capability); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | For the students with an intelligence of 5, list the full name and courses taken by them who have less than a 3 GPA. | SELECT T1.f_name, T1.l_name, T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.intelligence = 5 AND T1.gpa < 3 | full name of the students = f_name, l_name; gpa < 3; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the average capability of students with less than a 2.5 GPA? | SELECT CAST(SUM(T1.capability) AS REAL) / COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa < 2.5 | average capability = AVG(capability); gpa < 2.5; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | List the full name of the professors who advised students with intelligence 1. | SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.intelligence = 1 | full name of the professors = first_name, last_name; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the difference in the average GPA of students who took the hardest and easiest courses? | SELECT AVG(T1.gpa) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.diff IN (2, 1) GROUP BY T3.diff | difference in the average gpa = SUBTRACT(AVG(gpa WHERE MAX(diff)), AVG(gpa where min(diff))); difficulty of the course refers to diff; hardest course refers to MAX(diff); easiest course refers to MIN(diff); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Give the full name and capability of students who failed in any courses. | SELECT T2.f_name, T2.l_name, T1.capability FROM RA AS T1 INNER JOIN student AS T2 ON T2.student_id = T1.student_id INNER JOIN registration AS T3 ON T2.student_id = T3.student_id WHERE T3.grade IS NULL OR T3.grade = '' | full name of students = f_name, l_name; failed refers to grade IS NULL; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Of the students with high salaries, how many took the computer vision course? | SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN registration AS T2 ON T2.student_id = T1.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.salary = 'high' AND T3.name = 'Computer Vision' | high salaries refers to salary = 'High'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Find the full name and popularity of the professor who advises the most number of students. | SELECT T1.first_name, T1.last_name, T1.popularity FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id ORDER BY COUNT(T2.student_id) DESC LIMIT 1 | full name of the professor = first_name, last_name; most number of students refers to MAX(COUNT(student_id)); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Please give the name of the course in which most numbers of the students got an A. Also, list the full name of the students who got an A in this course. | SELECT T3.name, T2.f_name, T2.l_name FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'A' GROUP BY T3.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1 | most number of students got an A refers MAX(COUNT(student_id WHERE grade = 'A')); full name = f_name, l_name; got an A refers to grade = 'A'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Calculate the difference between the average satisfaction of the students with high salaries and no salary. | SELECT AVG(T2.sat) - ( SELECT AVG(T2.sat) FROM RA AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free' ) AS diff FROM RA AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high' | average satisfaction difference = SUBTRACT(AVG(sat where salary = 'high')), (AVG(sat where salary = 'free')); satisfaction refers to sat; no salary refers to salary = 'free'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Find the university from which the professor who advised most undergraduate students graduated. | SELECT T1.graduate_from FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.type = 'UG' GROUP BY T1.prof_id ORDER BY COUNT(T2.student_id) DESC LIMIT 1 | university from which the professor graduated refers to graduate_from; undergraduate students refers to type = 'UG'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among the professors with more than average teaching ability, list the full name and email address of the professors who advise two or more students. | SELECT T2.first_name, T2.last_name, T2.email FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability > ( SELECT AVG(teachingability) FROM prof ) GROUP BY T2.prof_id HAVING COUNT(T1.student_id) >= 2 | more than average teaching ability refers to teachingability > AVG(teachingability); full_name of the professor = first_name, last_name; email address of the professor refers to email; advises two or more students refers to COUNT(student_id) > = 2;
|
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What percentage of students are highly satisfied with the Intro to Database 2 course? | SELECT CAST(( SELECT COUNT(*) FROM course WHERE name = 'Intro to Database 2' AND course_id IN ( SELECT course_id FROM registration WHERE sat = ( SELECT MAX(sat) FROM registration ) ) ) AS REAL) * 100 / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = '... | percentage = MULTIPLY(DIVIDE(COUNT(MAX(sat)), (COUNT(student_id))), 1.0); highly satisfied refers to MAX(sat); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the first and last name of students with highest gpa? | SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student ) | first name refers of students refers to f_name; last name of students refers to l_name; highest gpa refers to MAX(gpa); |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among professors with the highest teachability, how many of their students have high salary? | SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T1.salary = 'high' ORDER BY T2.teachingability DESC LIMIT 1 | highest teachability refers to MAX(teachability); high salary refers to salary = 'high'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | What is the salary range of the student with an email of grosellg@hku.hk? | SELECT T1.salary FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.email = 'grosellg@hku.hk' | salary range refers to salary; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among students that gave satisfaction of value 4 for the course named "Statistical Learning", how many of them have a gpa of 3.8? | SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Statistical learning' AND T2.sat = 4 AND T1.gpa = 3.8 | satisfaction refers to sat;
sat = 4; gpa = 3.8 |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among courses with difficulty of 3, how many students have intellegence level of 2? | SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.diff = 3 AND T1.intelligence = 2 | difficulty of 3 refers to diff = 3; intelligence = 2 |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | List the student's first and last name that got a C in the course named "Applied Deep Learning". | SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Applied Deep Learning ' AND T2.grade = 'C' | student's first name refers to f_name; student's last name refers to l_name; got a C refers to grade = 'C'; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among research postgraduate students, give the name of the course with the student satisfaction value of 1. | SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.sat = 1 AND T1.type = 'RPG' | research postgraduate students refers to type = 'RPG'; name of the course refers to name; satisfaction refers to sat; sat = 1; |
cs_semester | CREATE TABLE "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_name TEXT,... | 【DB_ID】 cs_semester
【Schema】
# Table: main.RA
[
(student_id:INTEGER, Primary Key, Examples: [2, 5, 6]),
(capability:INTEGER, Examples: [2, 5, 4]),
(prof_id:INTEGER, Primary Key, Examples: [7, 10, 13]),
(salary:TEXT, Examples: [med, high, low])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [1, 2, 3... | Among the students with a capability below 3, what is the difference of undergraduate students from research postgraduate students? | SELECT SUM(CASE WHEN T2.type = 'UG' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.type = 'RPG' THEN 1 ELSE 0 END) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.capability < 3 | capability < 3; difference = subtract(count(type = 'UG')), (count(type = 'RPG')); undergraduate students refers to type = 'UG'; research postgraduate students refers to type = 'RPG'; |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | What is the average number of students for each advisor? | SELECT CAST(COUNT(p_id) AS REAL) / COUNT(DISTINCT p_id_dummy) AS avgnum FROM advisedBy GROUP BY p_id_dummy | students refers to advisedBy.p_id; advisor refers to p_id_dummy; average number = avg(count(advisedBy.p_id)) |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | How many professors are teaching course ID 18? | SELECT COUNT(DISTINCT p_id) FROM taughtBy WHERE course_id = 18 | professors refers to taughtBy.p_id; course ID 18 refers to taughtBy.course_id |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | List all the course IDs for professional or master/graduate courses. | SELECT course_id FROM course WHERE courseLevel = 'Level_500' | professional or master/graduate courses refers to courseLevel = 'Level_500' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | How many courses are there for basic or medium undergraduate courses? | SELECT COUNT(course_id) FROM course WHERE courseLevel = 'Level_300' | basic or medium undergraduate courses refers to courseLevel = 'Level_300'; courses refers to course.course_id |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | List the ID of all professors who are not faculty member along with the courses taught by him/her. | SELECT T2.p_id, T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition <> 0 | ID of all professors refers to person.p_id where professor = 1; not faculty member refers to hasPosition = 0; courses refers to taughtBy.course_id |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Provide the ID of professors who are teaching high-level or harder undergraduate course. | SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' | ID of professors refers to taughtBy.p_id; high-level or harder undergraduate course refers to courseLevel = 'Level_400' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | What are the courses taught by the advisors who gave advice to student with ID 376? | SELECT T3.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.p_id = 141 | courses refers to course_id; advisors refers to p_id_dummy and taughtBy.p_id; student with ID 376 refers to advisedBy.p_id = 376 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Name the advisors for students in Year 3 of the program. | SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_3' | advisors refers to p_id_dummy; students in Year 3 of the program refers to yearsInProgram = 'Year_3' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Which level of courses is taught by professor ID 297? | SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 297 | professor ID 297 refers to taughtBy.p_id = 297 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | What level is course 165? List the professors who teach the course. | SELECT T1.courseLevel, T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.course_id = 165 | course 165 refers to course_id = 165; professors refers to taughtBy.p_id |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | List the ID and years in program for students taught by advisor with ID 5. | SELECT T1.p_id, T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.p_id_dummy = 5 | advisor with ID 5 refers to p_id_dummy = 5 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | State the courses and level of courses by professors who are faculty employees. | SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition = 'Faculty_eme' | professors who are faculty employees refers to professor = 1; faculty employees refers to hasPosition = 'Faculty_eme' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Find the ID of advisor of student ID 80 and state the level of courses taught by him/her. | SELECT T1.p_id_dummy, T2.courseLevel FROM advisedBy AS T1 INNER JOIN course AS T2 ON T1.p_id = T2.course_id INNER JOIN taughtBy AS T3 ON T2.course_id = T3.course_id WHERE T1.p_id = 80 | ID of advisor refers to p_id_dummy; student ID 80 refers to advisedBy.p_id = 80; level of courses refers to courseLevel |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Provide the ID of professors who teach in both harder undergraduate course and master/graduate courses. | SELECT DISTINCT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' OR T1.courseLevel = 'Level_500' | harder undergraduate course refers to courseLevel = 'Level_400'; master/graduate courses refers to courseLevel = 'Level_500'; ID of professors refers to taughtBy.p_id |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Who are the professors who gave advice to students in the 12th years of program? | SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_12' | professors refers to p_id_dummy; 12th years of program refers to yearsInProgram = 'Year_12' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Which are the courses with the most number of professors? State the course ID and the level of the course. | SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.courseLevel ORDER BY COUNT(T1.course_id) DESC LIMIT 1 | courses refers taughtBy.course_id; most number of professors refers to max(count(taughtBy.p_id)); level of the course refers to courseLevel |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | How many basic and medium undergraduate courses are there? | SELECT COUNT(*) FROM course WHERE courseLevel = 'Level_300' | basic and medium undergraduate courses refers to courseLevel = 'Level_300' and courses refers to course.course_id |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | How many people teaches course no.11? | SELECT COUNT(*) FROM taughtBy WHERE course_id = 11 | people refers to taughtBy.p_id; course no.11 refers to course_id = 11 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Which course has more teachers, course no.16 or course no.18? | SELECT course_id FROM taughtBy WHERE course_id = 11 OR course_id = 18 GROUP BY course_id ORDER BY COUNT(course_id) DESC LIMIT 1 | teachers refers to taughtBy.p_id; course no.16 refers to course_id = 16; course no.18 refers to course_id = 18 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | How many teachers are faculty employees? | SELECT COUNT(*) FROM person WHERE hasPosition = 'Faculty_eme' | teachers refers to professor = 1; faculty employees refers to hasPosition = 'Faculty_eme' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Please list the IDs of the teachers who have advised more than 4 others to teach. | SELECT p_id_dummy FROM advisedBy GROUP BY p_id_dummy HAVING COUNT(p_id_dummy) > 4 | teachers refers to p_id_dummy; have advised more than 4 others refers to count(advisedBy.p_id) > 4 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | How many basic or medium undergraduate courses are taught by a professor? | SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.courseLevel = 'Level_300' AND T3.professor = 1 | basic or medium undergraduate courses refers to courseLevel = 'Level_300'; professor refers to professor = 1 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Please list the IDs of all the faculty employees who teaches a basic or medium undergraduate course. | SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T3.p_id = T2.p_id WHERE T1.courseLevel = 'Level_300' AND T3.hasPosition = 'Faculty_eme' | faculty employees refers to hasPosition = 'Faculty_eme'; basic or medium undergraduate course refers to courseLevel = 'Level_300' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Is the teacher who teaches course no.9 a faculty member? | SELECT T2.hasPosition FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 9 | teacher refers to taughtBy.p_id; course no.9 refers to taughtBy.course_id = 9; faculty member refers to hasPosition ! = 0 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Please list the levels of the all courses taught by teacher no.79. | SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 79 | levels of the all courses refers to courseLevel; teacher no.79 refers to taughtBy.p_id = 79 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Please list the IDs of the advisors of the students who are in the 5th year of their program. | SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_5' | IDs of the advisors refers to p_id_dummy; in the 5th year of their program refers to yearsInProgram = 'Year_5' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | How many students are advised to teach by a professor teaching basic or medium undergraduate courses? | SELECT COUNT(DISTINCT T4.p_id) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id INNER JOIN advisedBy AS T4 ON T4.p_id = T1.p_id WHERE T1.professor = 1 AND T3.courseLevel = 'Level_300' | students refers to advisedBy.p_id; professor refers to p_id_dummy and taughtBy.p_id and professor = 1; basic or medium undergraduate courses refers to courseLevel = 'Level_300' |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Among the courses that are basic or medium undergraduate courses, how many of them are taught by a faculty member? | SELECT COUNT(*) FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id INNER JOIN person AS T3 ON T2.p_id = T3.p_id WHERE T3.professor = 1 AND T1.courseLevel = 'Level_300' | courses that are basic or medium undergraduate courses refers to courseLevel = 'Level_300'; faculty member refers to hasPosition ! = 0 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | For the professor who advised student no.6, please list the IDs of the courses he or she teaches. | SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T3.p_id = T1.p_id WHERE T1.p_id = 9 | professor refers to p_id_dummy and professor = 1; student no.6 refers to advisedBy.p_id = 6; IDs of the courses refers to taughtBy.course_id |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | What is the level of the course with the most number of teachers? | SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id ORDER BY COUNT(T2.p_id) DESC LIMIT 1 | level of the course refers to courseLevel; course with most number of teachers refers to course_id = max(count(taughtBy.p_id)) |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Please list the IDs of the professors that teaches more than 3 courses. | SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY T1.p_id HAVING COUNT(DISTINCT T1.course_id) > 3 | IDs of the professors refers to taughtBy.p_id and professor = 1; teaches more than 3 courses refers to count(course_id) > 3 |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | Please list the IDs of the top 3 professors that teaches the most courses. | SELECT T1.p_id FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.professor = 1 GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 3 | IDs of the professors refers to taughtBy.p_id and professor = 1; teaches the most courses refers to max(count(course_id)) |
computer_student | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase... | 【DB_ID】 computer_student
【Schema】
# Table: main.advisedBy
[
(p_id:INTEGER, Primary Key, Examples: [6, 9, 13]),
(p_id_dummy:INTEGER, Primary Key, Examples: [5, 7, 29])
]
# Table: main.course
[
(course_id:INTEGER, Primary Key, Examples: [0, 1, 2]),
(courseLevel:TEXT, Examples: [Level_500, Level_300, Level_400])
]
# Table... | In total, all the students in the 3rd year of their program are advised by how many professors? | SELECT COUNT(DISTINCT T1.p_id_dummy) FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_3' | 3rd year of their program refers to yearsInProgram = 'Year_3'; professors refers to p_id_dummy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.