aherntech/sparc huggingface dataset:
Database: college_2
Question sequence:
What are the budgets of the Marketing department?
How about that for the Finance department?
What is their total budget?
SQL query sequence:
SELECT budget FROM department WHERE dept_name  =  'Marketing'
SELECT budget FROM department WHERE dept_name  =  'Finance'
SELECT sum(budget) FROM department WHERE dept_name  =  'Marketing' OR dept_name  =  'Finance'
Final question: What is the sum of budgets of the Marketing and Finance departments?
Final SQL: SELECT sum(budget) FROM department WHERE dept_name  =  'Marketing' OR dept_name  =  'Finance'
Database: college_2
Question sequence:
What is all the information about an instructor whose name contains 'Soisalon'?
What is their department name?
SQL query sequence:
SELECT * FROM instructor WHERE name LIKE '%Soisalon%'
SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'
Final question: What is the name of the department with an instructure who has a name like 'Soisalon'?
Final SQL: SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'
Database: college_2
Question sequence:
How many rooms are there in Lamberton?
Of those, how many have capacity less than 50?
SQL query sequence:
SELECT count(*) FROM classroom WHERE building  =  'Lamberton'
SELECT count(*) FROM classroom WHERE building  =  'Lamberton' AND capacity  <  50
Final question: Count the number of rooms in Lamberton with capacity lower than 50.
Final SQL: SELECT count(*) FROM classroom WHERE building  =  'Lamberton' AND capacity  <  50
Database: college_2
Question sequence:
What is the average department budget?
Which departments have a budget higher than that?
What are their names and budgets?
SQL query sequence:
SELECT avg(budget) FROM department
SELECT * FROM department WHERE budget  >  (SELECT avg(budget) FROM department)
SELECT dept_name ,  budget FROM department WHERE budget  >  (SELECT avg(budget) FROM department)
Final question: What are the names and budgets of departments with budgets greater than the average?
Final SQL: SELECT dept_name ,  budget FROM department WHERE budget  >  (SELECT avg(budget) FROM department)
Database: college_2
Question sequence:
What are the names of the professors in the Statistics department?
Which one earns the least?
SQL query sequence:
SELECT name FROM instructor WHERE dept_name  =  'Statistics'
SELECT name FROM instructor WHERE dept_name  =  'Statistics' ORDER BY salary LIMIT 1
Final question: Give the name of the lowest earning instructor in the Statistics department.
Final SQL: SELECT name FROM instructor WHERE dept_name  =  'Statistics' ORDER BY salary LIMIT 1
Database: college_2
Question sequence:
What are the titles of Statistics courses?
Of these, which are also listed as Psychology courses?
SQL query sequence:
SELECT title FROM course WHERE dept_name  =  'Statistics'
SELECT title FROM course WHERE dept_name  =  'Statistics' INTERSECT SELECT title FROM course WHERE dept_name  =  'Psychology'
Final question: What is the title of a course that is listed in both the Statistics and Psychology departments?
Final SQL: SELECT title FROM course WHERE dept_name  =  'Statistics' INTERSECT SELECT title FROM course WHERE dept_name  =  'Psychology'
Database: college_2
Question sequence:
What are the titles of Statistics courses?
Of these, which are not provided by the Psychology department?
SQL query sequence:
SELECT title FROM course WHERE dept_name  =  'Statistics'
SELECT title FROM course WHERE dept_name  =  'Statistics' EXCEPT SELECT title FROM course WHERE dept_name  =  'Psychology'
Final question: What are the titles of courses that are in the Statistics department but not the Psychology department?
Final SQL: SELECT title FROM course WHERE dept_name  =  'Statistics' EXCEPT SELECT title FROM course WHERE dept_name  =  'Psychology'
Database: college_2
Question sequence:
What are the ids of instructors who taught in the Fall of 2009?
Of those, which did not teach in the Spring of 2010?
SQL query sequence:
SELECT id FROM teaches WHERE semester  =  'Fall' AND YEAR  =  2009
SELECT id FROM teaches WHERE semester  =  'Fall' AND YEAR  =  2009 EXCEPT SELECT id FROM teaches WHERE semester  =  'Spring' AND YEAR  =  2010
Final question: What are the ids of instructors who taught in the Fall of 2009 but not in the Spring of 2010?
Final SQL: SELECT id FROM teaches WHERE semester  =  'Fall' AND YEAR  =  2009 EXCEPT SELECT id FROM teaches WHERE semester  =  'Spring' AND YEAR  =  2010
Database: college_2
Question sequence:
What are the distinct names of all the students?
Of these, which took classes in 2009 or 2010?
SQL query sequence:
SELECT DISTINCT name FROM student
SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id  =  T2.id WHERE YEAR  =  2009 OR YEAR  =  2010
Final question: What are the names of the students who took classes in 2009 or 2010?
Final SQL: SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id  =  T2.id WHERE YEAR  =  2009 OR YEAR  =  2010
Database: college_2
Question sequence:
How many courses does each department have?
Order their names from greatest to least.
What are the top 3?
SQL query sequence:
SELECT dept_name ,  count(*) FROM course GROUP BY dept_name
SELECT dept_name FROM course GROUP BY dept_name ORDER BY count(*) DESC
SELECT dept_name FROM course GROUP BY dept_name ORDER BY count(*) DESC LIMIT 3
Final question: What are the names of the 3 departments with the most courses?
Final SQL: SELECT dept_name FROM course GROUP BY dept_name ORDER BY count(*) DESC LIMIT 3
Database: college_2
Question sequence:
How many credits does each department offer?
What is the name of the department which offers the most?
SQL query sequence:
SELECT dept_name ,  sum(credits) FROM course GROUP BY dept_name
SELECT dept_name FROM course GROUP BY dept_name ORDER BY sum(credits) DESC LIMIT 1
Final question: What is the name of the department with the most credits?
Final SQL: SELECT dept_name FROM course GROUP BY dept_name ORDER BY sum(credits) DESC LIMIT 1
Database: college_2
Question sequence:
What are the titles of all courses?
Order them by titles and credits.
SQL query sequence:
SELECT title FROM course
SELECT title FROM course ORDER BY title ,  credits
Final question: Given the titles of all courses, in order of titles and credits.
Final SQL: SELECT title FROM course ORDER BY title ,  credits
Database: college_2
Question sequence:
Order the department names by increasing budget.
Which has the lowest?
SQL query sequence:
SELECT dept_name FROM department ORDER BY budget
SELECT dept_name FROM department ORDER BY budget LIMIT 1
Final question: Give the name of the department with the lowest budget.
Final SQL: SELECT dept_name FROM department ORDER BY budget LIMIT 1
Database: college_2
Question sequence:
Order the departments by decreasing budget.
In the same order, what are their names and buildings?
SQL query sequence:
SELECT * FROM department ORDER BY budget DESC
SELECT dept_name ,  building FROM department ORDER BY budget DESC
Final question: What are the names and buildings of the deparments, sorted by budget descending?
Final SQL: SELECT dept_name ,  building FROM department ORDER BY budget DESC
Database: college_2
Question sequence:
Order the instructor names by salary from greatest to least.
Who is paid the most?
SQL query sequence:
SELECT name FROM instructor ORDER BY salary DESC
SELECT name FROM instructor ORDER BY salary DESC LIMIT 1
Final question: Give the name of the highest paid instructor.
Final SQL: SELECT name FROM instructor ORDER BY salary DESC LIMIT 1
Database: college_2
Question sequence:
What is all the information about instructors?
Order this by increasing salary.
SQL query sequence:
SELECT * FROM instructor
SELECT * FROM instructor ORDER BY salary
Final question: Give all information regarding instructors, in order of salary from least to greatest.
Final SQL: SELECT * FROM instructor ORDER BY salary
Database: college_2
Question sequence:
What are the names and department names for each student?
Order this by total credits ascending.
SQL query sequence:
SELECT name ,  dept_name FROM student
SELECT name ,  dept_name FROM student ORDER BY tot_cred
Final question: What are the names of students and their respective departments, ordered by number of credits from least to greatest?
Final SQL: SELECT name ,  dept_name FROM student ORDER BY tot_cred
Database: college_2
Question sequence:
What were all the course titles in 2008?
Also, what were the instructors' names?
Order this by title.
SQL query sequence:
SELECT T1.title FROM course AS T1 JOIN teaches AS T2 ON T1.course_id  =  T2.course_id WHERE YEAR  =  2008
SELECT T1.title ,  T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id  =  T2.course_id JOIN instructor AS T3 ON T2.id  =  T3.id WHERE YEAR  =  2008
SELECT T1.title ,  T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id  =  T2.course_id JOIN instructor AS T3 ON T2.id  =  T3.id WHERE YEAR  =  2008 ORDER BY T1.title
Final question: Show all titles and their instructors' names for courses in 2008, in alphabetical order by title.
Final SQL: SELECT T1.title ,  T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id  =  T2.course_id JOIN instructor AS T3 ON T2.id  =  T3.id WHERE YEAR  =  2008 ORDER BY T1.title
Database: college_2
Question sequence:
What are the names of all instructors who advise students?
Of those, which advise more than one student?
SQL query sequence:
SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id  =  T2.i_id
SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id  =  T2.i_id GROUP BY T2.i_id HAVING count(*)  >  1
Final question: What are the names of instructors who advise more than one student?
Final SQL: SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.id  =  T2.i_id GROUP BY T2.i_id HAVING count(*)  >  1
Database: college_2
Question sequence:
What are the names of students with advisors?
Which ones have more than one advisor?
SQL query sequence:
SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id  =  T2.s_id
SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id  =  T2.s_id GROUP BY T2.s_id HAVING count(*)  >  1
Final question: What are the names of students who have more than one advisor?
Final SQL: SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id  =  T2.s_id GROUP BY T2.s_id HAVING count(*)  >  1
Database: college_2
Question sequence:
How many classrooms have capacity greater than 50?
Count these by building.
SQL query sequence:
SELECT count(*) FROM classroom WHERE capacity  >  50
SELECT count(*) ,  building FROM classroom WHERE capacity  >  50 GROUP BY building
Final question: How many rooms in each building have a capacity of over 50?
Final SQL: SELECT count(*) ,  building FROM classroom WHERE capacity  >  50 GROUP BY building
Database: college_2
Question sequence:
What are the maximum and average capacities across all classrooms?
Find these for each building.
SQL query sequence:
SELECT max(capacity) ,  avg(capacity) FROM classroom
SELECT max(capacity) ,  avg(capacity) ,  building FROM classroom GROUP BY building
Final question: What are the greatest and average capacity for rooms in each building?
Final SQL: SELECT max(capacity) ,  avg(capacity) ,  building FROM classroom GROUP BY building
Database: college_2
Question sequence:
What are all the different course titles?
Of those, which are offered in more than one department?
SQL query sequence:
SELECT title FROM course
SELECT title FROM course GROUP BY title HAVING count(*)  >  1
Final question: What are the titles of courses that are offered in more than one department?
Final SQL: SELECT title FROM course GROUP BY title HAVING count(*)  >  1
Database: college_2
Question sequence:
How many total credits are offered?
Find the totals by department name.
SQL query sequence:
SELECT sum(credits) FROM course
SELECT sum(credits) ,  dept_name FROM course GROUP BY dept_name
Final question: How many total credits are offered by each department?
Final SQL: SELECT sum(credits) ,  dept_name FROM course GROUP BY dept_name
Database: college_2
Question sequence:
What is the average salary of an instructor?
What are the departments with average salary greater than that?
Also, what are their lowest salaries?
SQL query sequence:
SELECT avg(salary) FROM instructor
SELECT dept_name FROM instructor GROUP BY dept_name HAVING avg(salary)  >  (SELECT avg(salary) FROM instructor)
SELECT min(salary) ,  dept_name FROM instructor GROUP BY dept_name HAVING avg(salary)  >  (SELECT avg(salary) FROM instructor)
Final question: What is the lowest salary in departments with average salary greater than the overall average.
Final SQL: SELECT min(salary) ,  dept_name FROM instructor GROUP BY dept_name HAVING avg(salary)  >  (SELECT avg(salary) FROM instructor)
Database: college_2
Question sequence:
How many courses are offered in each year?
Split these by semester as well.
SQL query sequence:
SELECT count(*) ,  YEAR FROM SECTION GROUP BY YEAR
SELECT count(*) ,  semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR
Final question: How many courses are provided in each semester and year?
Final SQL: SELECT count(*) ,  semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR
Database: college_2
Question sequence:
How many courses are offered in each year?
Which year had the most?
SQL query sequence:
SELECT YEAR ,  count(*) FROM SECTION GROUP BY YEAR
SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1
Final question: Which year had the greatest number of courses?
Final SQL: SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1
Database: college_2
Question sequence:
Find the number of courses in each semester and year.
Which had the most?
SQL query sequence:
SELECT semester ,  YEAR ,  count(*) FROM SECTION GROUP BY semester ,  YEAR
SELECT semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR ORDER BY count(*) DESC LIMIT 1
Final question: What is the year and semester with the most courses?
Final SQL: SELECT semester ,  YEAR FROM SECTION GROUP BY semester ,  YEAR ORDER BY count(*) DESC LIMIT 1
Database: college_2
Question sequence:
How many students are in each department?
What is the name of the department with the most?
SQL query sequence:
SELECT dept_name ,  count(*) FROM student GROUP BY dept_name
SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1
Final question: What is the name of the deparment with the highest enrollment?
Final SQL: SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1
Database: college_2
Question sequence:
How many students are there?
Count this by department.
SQL query sequence:
SELECT count(*) FROM student
SELECT count(*) ,  dept_name FROM student GROUP BY dept_name
Final question: How many students are in each department?
Final SQL: SELECT count(*) ,  dept_name FROM student GROUP BY dept_name
Database: college_2
Question sequence:
How many students were taking classes in each semester and year?
Which one had the fewest?
SQL query sequence:
SELECT semester ,  YEAR ,  count(*) FROM takes GROUP BY semester ,  YEAR
SELECT semester ,  YEAR FROM takes GROUP BY semester ,  YEAR ORDER BY count(*) LIMIT 1
Final question: Which semeseter and year had the fewest students?
Final SQL: SELECT semester ,  YEAR FROM takes GROUP BY semester ,  YEAR ORDER BY count(*) LIMIT 1
Database: college_2
Question sequence:
What are the ids of all instructors who are advisors?
Of these, which advise students in the History department?
SQL query sequence:
SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id
SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id WHERE T2.dept_name  =  'History'
Final question: Give id of the instructor who advises students in the History department.
Final SQL: SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id WHERE T2.dept_name  =  'History'
Database: college_2
Question sequence:
What are the ids of all instructors who are advisors?
Of these, which advise students in the History department?
What are their names and salaries?
SQL query sequence:
SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id
SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id WHERE T2.dept_name  =  'History'
SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'History'
Final question: What are the names and salaries of instructors who advises students in the History department?
Final SQL: SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'History'
Database: college_2
Question sequence:
What are the ids of courses with prerequisites?
What are the ids of all other courses?
SQL query sequence:
SELECT course_id FROM prereq
SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq
Final question: What are the ids of courses without prerequisites?
Final SQL: SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq
Database: college_2
Question sequence:
What are the ids of courses with prerequisites?
What are the titles of all other courses?
SQL query sequence:
SELECT course_id FROM prereq
SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
Final question: What are the names of courses without prerequisites?
Final SQL: SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
Database: college_2
Question sequence:
What are the ids of all prerequisites?
What is the id of the prerequisite for International Finance?
What is its title?
SQL query sequence:
SELECT prereq_id FROM prereq
SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'International Finance'
SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'International Finance')
Final question: Give the title of the prerequisite to the course International Finance.
Final SQL: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'International Finance')
Database: college_2
Question sequence:
What are the ids of all the prerequisites?
What is the id of the course for which Differential Geometry is a prerequisite?
What is its title?
SQL query sequence:
SELECT course_id FROM prereq
SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id  =  T2.course_id WHERE T2.title  =  'Differential Geometry'
SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id  =  T2.course_id WHERE T2.title  =  'Differential Geometry')
Final question: What is the title of the course with Differential Geometry as a prerequisite?
Final SQL: SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id  =  T2.course_id WHERE T2.title  =  'Differential Geometry')
Database: college_2
Question sequence:
What are the ids of students who took courses in the Fall of 2003?
What are their names?
SQL query sequence:
SELECT id FROM takes WHERE semester  =  'Fall' AND YEAR  =  2003
SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester  =  'Fall' AND YEAR  =  2003)
Final question: What are the names of students who took a course in the Fall of 2003?
Final SQL: SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester  =  'Fall' AND YEAR  =  2003)
Database: college_2
Question sequence:
What are the titles of courses offered in the Fall of 2010?
Of these, which were offered in Chandler building?
SQL query sequence:
SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id  =  T2.course_id WHERE semester  =  'Fall' AND YEAR  =  2010
SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id  =  T2.course_id WHERE building  =  'Chandler' AND semester  =  'Fall' AND YEAR  =  2010
Final question: Give the title of the course offered in Chandler during the Fall of 2010.
Final SQL: SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id  =  T2.course_id WHERE building  =  'Chandler' AND semester  =  'Fall' AND YEAR  =  2010
Database: college_2
Question sequence:
What are the names of all instructors?
Of those, which have taught a C Programming course?
SQL query sequence:
SELECT name FROM instructor
SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id  =  T2.id JOIN course AS T3 ON T2.course_id  =  T3.course_id WHERE T3.title  =  'C Programming'
Final question: What are the names of instructors who have taught C Programming courses?
Final SQL: SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id  =  T2.id JOIN course AS T3 ON T2.course_id  =  T3.course_id WHERE T3.title  =  'C Programming'
Database: college_2
Question sequence:
What are the ids of all advisors?
What are the ids of advisors who advise students in the Math department?
What are their names and salaries?
SQL query sequence:
SELECT i_id FROM advisor
SELECT T1.i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id WHERE T2.dept_name  =  'Math'
SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math'
Final question: What are the names and salaries of instructors who advise students in the Math department?
Final SQL: SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math'
Database: college_2
Question sequence:
What are the ids of advisors who advise students in the Math department?
What are their names?
Order this by the students' total credits.
SQL query sequence:
SELECT T1.i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id  =  T2.id WHERE T2.dept_name  =  'Math'
SELECT T2.name ,  T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math'
SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math' ORDER BY T3.tot_cred
Final question: What are the names of all instructors who advise students in the math depart sorted by total credits of the student.
Final SQL: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id WHERE T3.dept_name  =  'Math' ORDER BY T3.tot_cred
Database: college_2
Question sequence:
What are all the ids of the prerequisite classes?
Of these, which is the prerequisite for Mobile Computing?
What is its title?
SQL query sequence:
SELECT prereq_id FROM prereq
SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'Mobile Computing'
SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'Mobile Computing')
Final question: What is the title of the course that is a prerequisite for Mobile Computing?
Final SQL: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.title  =  'Mobile Computing')
Database: college_2
Question sequence:
What are names of instructors who advise students?
Of these, which one instructs the students with the most total credits?
SQL query sequence:
SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id
SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id ORDER BY T3.tot_cred DESC LIMIT 1
Final question: What is the name of the instructor who advises the student with the greatest number of total credits?
Final SQL: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id  =  T2.id JOIN student AS T3 ON T1.s_id  =  T3.id ORDER BY T3.tot_cred DESC LIMIT 1