Text-to-SQL
Collection
2 items • Updated
question_id int64 3 9.42k | db_id stringclasses 69
values | grading_method stringclasses 13
values | question stringlengths 25 330 | evidence stringlengths 0 580 ⌀ | SQL stringlengths 31 1.33k |
|---|---|---|---|---|---|
168 | book_publishing_company | multiset | What is the title with the most ordered quantity in year 1992? | total quantity refers to SUM(qty); most ordered quantity refers to order with the highest quantity where MAX(SUM(qty)); date refers to ord_date; year 1992 refers to YEAR(ord_date) = 1992 | SELECT T2.title
FROM sales AS T1
JOIN titles AS T2 ON T1.title_id = T2.title_id
WHERE STRFTIME('%Y', T1.ord_date) = '1992'
GROUP BY T1.title_id
ORDER BY SUM(T1.qty) DESC
LIMIT 1; |
175 | book_publishing_company | multiset | List all titles published in year 1991. Also provide notes details of the title and the publisher's name. | publisher name refers to pub_name; publication date refers to pubdate; published in year 1991 refers to YEAR(pubdate) = 1991 | SELECT T1.title, T1.notes, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE STRFTIME('%Y', T1.pubdate) = '1991' |
183 | book_publishing_company | multiset | In which year has the most hired employees? | most hired employees refers to MAX(count(emp_id)) | SELECT STRFTIME('%Y', hire_date) FROM employee GROUP BY STRFTIME('%Y', hire_date) ORDER BY COUNT(emp_id) DESC LIMIT 1 |
196 | book_publishing_company | multiset | Calculate the percentage of the employees who are Editor or Designer? | Editor or Auditor are job description which refers to job_desc; percentage = DIVIDE(count(job_desc = 'Editor' or job_desc = 'Designer'), count(emp_id))*100 | SELECT CAST(SUM(CASE WHEN T2.job_desc IN ('Editor', 'Designer') THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.job_id) FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id |
209 | book_publishing_company | multiset | Please give more detailed note information about the first four books that sell the best. | qty is abbreviation for quantity; sells the best mean with the most sales quantity; MAX(SUM(qty)) | SELECT t.notes
FROM `titles` t
JOIN (
SELECT `title_id`, SUM(`qty`) AS total_qty
FROM `sales`
GROUP BY `title_id`
ORDER BY total_qty DESC
LIMIT 4
) s ON t.`title_id` = s.`title_id`; |
214 | book_publishing_company | multiset | Which type of book had the most pre-paid amount? | most pre-paid amount refers to MAX(advance) | SELECT type FROM titles ORDER BY advance DESC LIMIT 1 |
216 | book_publishing_company | multiset | Which job level is O'Rourke at? | job level refers to job_lvl | SELECT job_lvl FROM employee WHERE lname = 'O''Rourke' |
223 | book_publishing_company | multiset | List the type of the book for the order which was sold on 1993/5/29. | sold on refers to ord_date | SELECT DISTINCT T1.type FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id WHERE STRFTIME('%Y-%m-%d', T2.ord_date) = '1993-05-29' |
227 | book_publishing_company | multiset | How many sales did the store in Remulade make? | Remulade is a city; sales in the store refers to ord_num | SELECT COUNT(DISTINCT T1.ord_num) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id WHERE T2.city = 'Remulade' |
228 | book_publishing_company | multiset | For the quantities, what percent more did the store in Fremont sell than the store in Portland in 1993? | "qty is abbreviation for quantity; Fremont and Portland are name of city; sell in 1993 refers to YEAR(ord_date) = 1993; percentage = DIVIDE(
SUBTRACT(SUM(qty where city = ‘Fremont’ and year(ord_date = 1993)),
SUM(qty where city = ‘Portland’ and year(ord_date = 1993))), SUM(qty where city = ‘Portland’ and year(ord_date... | SELECT
(SUM(CASE WHEN st.city = 'Fremont' THEN sa.qty END) -
SUM(CASE WHEN st.city = 'Portland' THEN sa.qty END)) * 100.0
/ SUM(CASE WHEN st.city = 'Portland' THEN sa.qty END) AS percent_more
FROM sales AS sa
JOIN stores AS st ON sa.stor_id = st.stor_id
WHERE STRFTIME('%Y', sa.ord_date) = '1993'; |
233 | book_publishing_company | list | List the title name, type, and price of the titles published by New Moon Books. Arrange the list in ascending order of price. | Eric the Read Books is a publisher which refers to pub_name; | SELECT T1.title, T1.type, T1.price FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.pub_name = 'New Moon Books' ORDER BY T1.price |
239 | book_publishing_company | list | Name the top five titles that sold more than average and list them in descending order of the number of sales in California stores? | qty is abbreviation for quantity; sold more than average refers to qty > AVG(qty); california refers to state = 'CA" | WITH ca_sales AS (
SELECT s.title_id,
SUM(s.qty) AS total_qty
FROM sales s
JOIN stores st ON s.stor_id = st.stor_id
WHERE st.state = 'CA'
GROUP BY s.title_id
),
avg_ca AS (
SELECT AVG(total_qty) AS avg_qty FROM ca_sales
)
SELECT t.title
FROM ca_sales cs
JOIN avg_ca a
JOIN titles t ON ... |
571 | codebase_comments | multiset | What is the most liked repository? Indicate its github address and the amount of stars it has received. | more stars mean more people like this repository; most liked refers to max(Stars); the github address of repository refers to Url; | SELECT Url, Stars FROM Repo WHERE Stars = ( SELECT MAX(Stars) FROM Repo ) |
574 | codebase_comments | multiset | What is the github address of the "nofear_Mara\Mara.sln" solution path? | github address of repository refers to Url; | SELECT Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE Path = 'nofear_Mara\Mara.sln' |
575 | codebase_comments | multiset | Which repository has the longest amount of processed time of downloading? Indicate whether the solution paths in the repository can be implemented without needs of compilation, Yes or No | longest amount of processed time refers to max(ProcessedTime); the repository can be implemented without needs of compilation refers to WasCompiled = 1 for all solutions; | SELECT r.Id AS RepoId,
CASE WHEN MIN(CASE WHEN s.WasCompiled = 1 THEN 1 ELSE 0 END) = 1 THEN 'Yes' ELSE 'No' END AS CanRunWithoutCompilation
FROM Repo r
LEFT JOIN Solution s ON s.RepoId = r.Id
WHERE r.ProcessedTime = (SELECT MAX(ProcessedTime) FROM Repo)
GROUP BY r.Id; |
588 | codebase_comments | multiset | Are the comments for the method "HtmlSharp.HtmlParser.Feed" in XML format? Yes or No. | the comment for this method is not XML refers to CommentsXML = 0; the comments for this method is XML refers to CommentsXML = 1 | SELECT CASE WHEN CommentIsXml = 0 THEN 'No' WHEN CommentIsXml = 1 THEN 'Yes' END isXMLFormat FROM Method WHERE Name = 'HtmlSharp.HtmlParser.Feed' |
593 | codebase_comments | multiset | Among the solutions that contain files within the repository followed by over 1000 people, how many of them can be
implemented without needs of compilation? | followed by over 1000 people refers to Forks >1000; can be
implemented without needs of compilation refers to WasCompiled = 1; | SELECT COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Forks > 1000 AND T2.WasCompiled = 1 |
594 | codebase_comments | multiset | Which solution contains files within a more popular repository, the solution ID18 or solution ID19? | more watchers mean that this repository is more popular; | SELECT CASE WHEN SUM(CASE WHEN T2.Id = 18 THEN T1.Watchers ELSE 0 END) > SUM(CASE WHEN T2.Id = 19 THEN T1.Watchers ELSE 0 END) THEN 'SolutionID18' WHEN SUM(CASE WHEN T2.Id = 18 THEN T1.Watchers ELSE 0 END) < SUM(CASE WHEN T2.Id = 19 THEN T1.Watchers ELSE 0 END) THEN 'solutionI D19' END isMorePopular FROM Repo AS T1 INN... |
596 | codebase_comments | multiset | What is the processed time to download the repository whose files are contained in the solution with the path "jeffdik_tachy\src\Tachy.sln". | null | SELECT DISTINCT T2.ProcessedTime FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Path = 'jeffdik_tachy\src\Tachy.sln' |
598 | codebase_comments | multiset | Please list all the paths of the solutions containing files within the repository whose url is "https://github.com/maxild/playground.git". | null | SELECT T2.Path FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/maxild/playground.git' |
608 | codebase_comments | multiset | For the repository which got '8094' Stars, how many solutions does it contain? | repository refers to Repo.Id; | SELECT COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars = 8094 |
609 | codebase_comments | multiset | What is the solution path for the method "IQ.Data.DbQueryProvider.CanBeEvaluatedLocally"? | solution path refers to Path; method refers to Name; Name = 'IQ.Data.DbQueryProvider.CanBeEvaluatedLocally' | SELECT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Name = 'IQ.Data.DbQueryProvider.CanBeEvaluatedLocally' |
611 | codebase_comments | multiset | What is the repository number for the solution of method "SCore.Poisson.ngtIndex"? | repository number refers to RepoId; method refers to Name; Name = ‘SCore.Poisson.ngtIndex’ | SELECT T1.RepoId FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Name = 'SCore.Poisson.ngtIndex' |
617 | codebase_comments | multiset | Give the number of watchers that the repository of the solution No. 326689 have. | number of watchers refers to Watchers; solution number refers to Solution.Id; | SELECT T1.Watchers FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Id = 326689 |
618 | codebase_comments | multiset | For each repository that got 189 Stars, how many solutions that needs to be compiled does it contain? List the repository ids and the number of mentioned solutions, respsectively. | repository refers to Repository.Id; solution needs to be compiled refers to WasCompiled = 0; | SELECT r.Id AS RepoId,
COUNT(s.Id) AS NumSolutionsNeedingCompile
FROM Repo r
LEFT JOIN Solution s
ON r.Id = s.RepoId AND s.WasCompiled = 0
WHERE r.Stars = 189
GROUP BY r.Id; |
621 | codebase_comments | multiset | Give the repository ID for the solution of method "Kalibrasi.Data.EntityClasses.THistoryJadwalEntity.GetSingleTjadwal". | repository ID refers to RepoID; method refers to Name; Name = 'Kalibrasi.Data.EntityClasses.THistoryJadwalEntity.GetSingleTjadwal'; | SELECT DISTINCT T1.RepoId FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Name = 'Kalibrasi.Data.EntityClasses.THistoryJadwalEntity.GetSingleTjadwal' |
630 | codebase_comments | multiset | What is the total processed time of all solutions from the repository with the most forks? | total processed time = SUM(ProcessedTime where MAX(COUNT(Forks))); repository with the most forks refers to MAX(COUNT(Forks)); | SELECT SUM(T2.ProcessedTime), T1.Id FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Forks = ( SELECT MAX(Forks) FROM Repo ) GROUP BY T1.Id |
636 | codebase_comments | multiset | What is the repository id of the method with tokenized name "crc parameters get hash code"? | repository id refers to RepoId; tokenized name refers to NameTokenized; NameTokenized = 'crc parameters get hash code'; | SELECT T1.RepoId FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized = 'crc parameters get hash code' |
638 | codebase_comments | multiset | List all the solutions ids of the repository with "636430968896066073" processed time | solution ids refers to Solution.Id; | SELECT T2.Id FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.ProcessedTime = 636430968896066073 |
640 | codebase_comments | multiset | List all the solutions of repositories with the Forks higher than half of the watchers. | solutions refers to Solution.Id; forks higher than half of the watchers refers tto Forks>(Watchers/2);; | SELECT DISTINCT T2.Id FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Forks > T1.Watchers / 2 |
646 | codebase_comments | multiset | Please provide the number of stars that the repository of the solution 20 have. | solution refers to Solution.ID; Solution.Id = 20; | SELECT T1.Stars FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Id = 20 |
649 | codebase_comments | multiset | Please list the names of methods with the solution path "wallerdev_htmlsharp\HtmlSharp.sln". | name of the methods refers to Name; solution path refers to Path; Path = 'wallerdev_htmlsharp\HtmlSharp.sln'; | SELECT T2.Name FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'wallerdev_htmlsharp\HtmlSharp.sln' |
651 | codebase_comments | multiset | What is the url of solution 1? | solution refers to Solution.Id; Solution.Id = 1; | SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Id = 1 |
654 | codebase_comments | multiset | Please provide the path of solution of method whose tokenized name is html parser feed. | path of solution refers to Path; tokenized name refers to NameTokenized; NameTokenized = ''html parser feed'; | SELECT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized = 'html parser feed' |
656 | codebase_comments | multiset | Among the english methods, please list the tokenized names of methods whose solutions does not need to be compiled. | english methods refers to lang = 'en'; tokenized name refers to NameTokenized; solution needs to be compiled refers to WasCompiled = 0; | SELECT NameTokenized FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE Lang = 'en' AND WasCompiled = 1 |
657 | codebase_comments | multiset | How many solutions whose repository's stars are a third more than forks? | solutions refers to Solution.Id; repository stars are a third more than forks = (MULTIPLY(Forks, 4/3))<Stars; | SELECT COUNT(*)
FROM `Solution` AS s
JOIN `Repo` AS r ON s.`RepoId` = r.`Id`
WHERE r.`Stars` >= r.`Forks`*4.0/3; |
665 | codebase_comments | multiset | Please provide a link to the most well-known repository's Github address. | link refers to Url; well-known repository refers to MAX(Watchers); | SELECT Url FROM Repo WHERE Watchers = ( SELECT MAX(Watchers) FROM Repo ) |
670 | codebase_comments | multiset | How many methods in the same repository share a tokenized name that begins with "query language..."? | tokenized name refers to NameTokenized; NameTokenized LIKE 'query language%'; | SELECT SUM(cnt)
FROM (
SELECT s.`RepoId` AS RepoId, COUNT(*) AS cnt
FROM `Method` m
JOIN `Solution` s ON s.`Id` = m.`SolutionId`
WHERE m.`NameTokenized` LIKE 'query language%'
GROUP BY s.`RepoId`
HAVING COUNT(*) > 1
); |
678 | codebase_comments | subset,=,5 | List 5 github address that the solutions can be implemented without the need of compilation. | github address refers to Url; solution can be implemented without the need of compliation refers to WasCompiled = 1; | SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.WasCompiled = 1 |
681 | codebase_comments | subset,=,5 | List 5 solution path that has sampling time of 636431758961741000. | solution path refers to Path; sampling time refers to SampledAt; SampledAt = '636431758961741000'; | SELECT DISTINCT T1.Path FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.SampledAt = 636431758961741000 |
686 | codebase_comments | multiset | "How many liked by people does the solution path ""ninject_Ninject\Ninject.sln"" have?" | how many liked by people refers to Stars; solution path refers to Path; Path = 'ninject_Ninject\Ninject.sln'; | SELECT DISTINCT T1.Stars FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.Path = 'ninject_Ninject\Ninject.sln' |
688 | codebase_comments | multiset | What is the average processed time of the solution with a repository of 254 likes, 88 followers, and 254 watchers? | average processed time = AVG(ProcessedTime); | SELECT CAST(SUM(T2.ProcessedTime) AS REAL) / COUNT(T2.ProcessedTime) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars = 254 AND T1.Forks = 88 AND T1.Watchers = 254 |
855 | cs_semester | multiset | Please list the names of the courses that are less important than Machine Learning Theory. | lower credit means less important; | SELECT name FROM course WHERE credit < ( SELECT credit FROM course WHERE name = 'Machine Learning Theory' ) |
857 | cs_semester | multiset | What is the phone number of Kerry Pryor? | null | SELECT phone_number FROM student WHERE l_name = 'Pryor' AND f_name = 'Kerry' |
862 | cs_semester | multiset | Please list the full names of all the students who took the course Machine Learning Theory. | full name refers to f_name and l_name; | 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 = 'Machine Learning Theory' |
866 | cs_semester | multiset | Which student is more satisfied with the course Machine Learning Theory, Willie Rechert or Laughton Antonio? | sat refers to student's satisfaction degree with the course; more satisfied refers to MAX(sat); | 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 (T1.f_name = 'Laughton' OR T1.f_name = 'Willie') AND (T1.l_name = 'Antonio' OR T1.l_name = 'Rechert') AND T3.name = 'Machine Learning Theory' ORDER B... |
868 | cs_semester | multiset | Among the students who took the course Machine Learning Theory, how many of them are undergraduates? | UG is an abbreviated name of undergraduate student in which type = 'UG'; | 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 = 'Machine Learning Theory' AND T1.type = 'UG' |
869 | cs_semester | multiset | Which professor advised Willie Rechert to work as a research assistant? Please give his or her full name. | research assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; full name refers to f_name and l_name; | 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.f_name = 'Willie' AND T3.l_name = 'Rechert' |
889 | cs_semester | multiset | What is the full name of the professor who graduated from an Ivy League School? | Ivy League school is assembled by 8 universities: Brown University, Columbia University, Cornell University, Dartmouth College, Harvard University, Princeton University, University of Pennsylvania and Yale University; | SELECT first_name, last_name FROM prof WHERE graduate_from IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' ) |
892 | cs_semester | multiset | Among the most popular professors, how many are females? | the most popular professors refers to prof_id where MAX(popularity); female refers to gender; | SELECT COUNT(prof_id) FROM prof WHERE gender = 'Female' AND popularity = ( SELECT MAX(popularity) FROM prof ) |
896 | cs_semester | multiset | Among the easiest courses, what is the name of the course where most students got an A? | diff refers to difficulty; the easiest courses refers to diff = 1; A refers to an excellent grade in which grade = 'A' for the course; | 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.diff = 1 GROUP BY T2.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1 |
897 | cs_semester | multiset | How many courses does the student with the highest GPA this semester take? | student with the highest GPA refers to student_id where MAX(gpa); | SELECT COUNT(course_id) FROM registration WHERE student_id IN ( SELECT student_id FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student ) ) |
900 | cs_semester | multiset | What are the names of the courses that the students with the lowest intelligence are least satisfied with? | lower intelligence refers to intelligence = 1; sat refers to student's satisfaction degree with the course where least satisfaction refers to sat = 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.intelligence = 1 |
904 | cs_semester | multiset | How many students, who have a GPA between 3 to 4, failed a course? | 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; | SELECT COUNT(DISTINCT 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 |
907 | cs_semester | multiset | List the professors' IDs and students' IDs with the lowest research ability. | the lowest research ability refers to MIN(capability); professor’s ID refers to prof_id; | SELECT prof_id, student_id FROM RA WHERE capability = ( SELECT MIN(capability) FROM RA ) |
916 | cs_semester | set | Among students registered for the most difficult course, list the students' full names who got grade A. | difficulty refers to diff; most difficult course refers to MAX(diff); student's full names = f_name, l_name; | SELECT DISTINCT s.`f_name`, s.`l_name`
FROM `student` AS s
JOIN `registration` AS r ON s.`student_id` = r.`student_id`
JOIN `course` AS c ON r.`course_id` = c.`course_id`
WHERE c.`diff` = (SELECT MAX(`diff`) FROM `course`)
AND r.`grade` = 'A'; |
920 | cs_semester | set | Provide the registered courses' names by undergraduate students with GPA of 3.7 and above. | Undergraduate students refers to type = 'UG'; GPA of 3.7 and above refers to gpa >= 3.7; | SELECT DISTINCT `c`.`name`
FROM `student` AS `s`
JOIN `registration` AS `r` ON `s`.`student_id` = `r`.`student_id`
JOIN `course` AS `c` ON `r`.`course_id` = `c`.`course_id`
WHERE `s`.`type` = 'UG' AND `s`.`gpa` >= 3.7; |
933 | cs_semester | multiset | In students with a grade of B, how many of them have an intellegence level of 3? | null | SELECT COUNT(DISTINCT 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 |
955 | cs_semester | multiset | Calculate the difference in average satisfaction between students with 'high' salaries and those with 'free' salaries, based on each student's mean satisfaction score. | average satisfaction difference = SUBTRACT(AVG(sat where salary = 'high')), (AVG(sat where salary = 'free')); satisfaction refers to sat; no salary refers to salary = 'free'; | WITH ra_flag AS (
SELECT `student_id`,
MAX(CASE WHEN `salary` = 'high' THEN 1 END) AS high_flag,
MAX(CASE WHEN `salary` = 'free' THEN 1 END) AS free_flag
FROM `RA`
GROUP BY `student_id`
),
student_sat AS (
SELECT `student_id`, AVG(`sat`) AS avg_sat
FROM `registration`
GROUP... |
956 | cs_semester | multiset | Find the university from which the professor who advised most undergraduate students graduated. | university from which the professor graduated refers to graduate_from; undergraduate students refers to type = 'UG'; | 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 |
957 | cs_semester | multiset | 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. | 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;
| 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 |
962 | cs_semester | multiset | Among students that gave satisfaction of value 4 for the course named "Statistical learning", how many of them have a gpa of 3.8? | satisfaction refers to sat;
sat = 4; gpa = 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 |
968 | computer_student | multiset | How many professors are teaching course ID 18? | professors refers to taughtBy.p_id; course ID 18 refers to taughtBy.course_id | SELECT COUNT(DISTINCT t.`p_id`)
FROM `taughtBy` AS t
JOIN `person` AS p ON t.`p_id` = p.`p_id`
WHERE t.`course_id` = 18
AND p.`professor` = 1; |
972 | computer_student | multiset | Provide the ID of professors who are teaching high-level or harder undergraduate course. | ID of professors refers to taughtBy.p_id; high-level or harder undergraduate course refers to courseLevel = 'Level_400' | SELECT DISTINCT tb.`p_id`
FROM `taughtBy` tb
JOIN `course` c ON c.`course_id` = tb.`course_id`
JOIN `person` p ON p.`p_id` = tb.`p_id`
WHERE c.`courseLevel` = 'Level_400'
AND p.`professor` = 1; |
974 | computer_student | set | Name the advisors for students in Year 3 of the program. | advisors refers to p_id_dummy; students in Year 3 of the program refers to yearsInProgram = 'Year_3' | SELECT DISTINCT `T1`.`p_id_dummy`
FROM `advisedBy` AS `T1`
JOIN `person` AS `S` ON `S`.`p_id` = `T1`.`p_id`
WHERE `S`.`yearsInProgram` = 'Year_3'; |
975 | computer_student | multiset | Which level of courses is taught by professor ID 297? | professor ID 297 refers to taughtBy.p_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 |
980 | computer_student | set | Provide the ID of professors who teach in both harder undergraduate course and master/graduate courses. | harder undergraduate course refers to courseLevel = 'Level_400'; master/graduate courses refers to courseLevel = 'Level_500'; ID of professors refers to taughtBy.p_id | SELECT DISTINCT tb.`p_id`
FROM `taughtBy` AS tb
JOIN `course` AS c ON tb.`course_id` = c.`course_id`
JOIN `person` AS p ON p.`p_id` = tb.`p_id`
WHERE p.`professor` = 1
GROUP BY tb.`p_id`
HAVING SUM(CASE WHEN c.`courseLevel` = 'Level_400' THEN 1 ELSE 0 END) > 0
AND SUM(CASE WHEN c.`courseLevel` = 'Level_500' THEN 1 E... |
984 | computer_student | multiset | How many people teaches course no.11? | people refers to taughtBy.p_id; course no.11 refers to course_id = 11 | SELECT COUNT(T1.p_id) FROM taughtBy T1 JOIN person T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 11 AND T2.professor = 1; |
989 | computer_student | multiset | Please list the IDs of all the faculty employees who teaches a basic or medium undergraduate course. | faculty employees refers to hasPosition = 'Faculty_eme'; basic or medium undergraduate course refers to courseLevel = 'Level_300' | 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' |
990 | computer_student | multiset | Is the teacher who teaches course no.9 a faculty member? Yes or No | teacher refers to taughtBy.p_id; course no.9 refers to taughtBy.course_id = 9; faculty member refers to hasPosition ! = 0 | SELECT CASE WHEN T2.hasPosition != 0 THEN 'Yes' ELSE 'No' END FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.course_id = 9 |
991 | computer_student | multiset | Please list the levels of the all courses taught by teacher no.79. | levels of the all courses refers to courseLevel; teacher no.79 refers to taughtBy.p_id = 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 |
992 | computer_student | set | Please list the IDs of the advisors of the students who are in the 5th year of their program. | IDs of the advisors refers to p_id_dummy; in the 5th year of their program refers to yearsInProgram = 'Year_5' | 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' |
994 | computer_student | multiset | Among the courses that are basic or medium undergraduate courses, how many of them are taught by a faculty member? | courses that are basic or medium undergraduate courses refers to courseLevel = 'Level_300'; faculty member refers to hasPosition ! = 0 | SELECT COUNT(DISTINCT c.`course_id`)
FROM `course` AS c
JOIN `taughtBy` AS t ON c.`course_id` = t.`course_id`
JOIN `person` AS p ON t.`p_id` = p.`p_id`
WHERE c.`courseLevel` = 'Level_300'
AND p.`hasPosition` <> '0'; |
1,000 | computer_student | multiset | What is the average number of courses taught by a professor? | professor refers to professor = 1; average number of courses = divide(count(taughtBy.course_id), count(taughtBy.p_id) where professor = 1 ) | SELECT CAST(SUM(CASE WHEN tb.course_id IS NULL THEN 0 ELSE 1 END) AS REAL)
/ COUNT(*) AS avg_courses_per_prof
FROM person p
LEFT JOIN taughtBy tb ON p.p_id = tb.p_id
WHERE p.professor = 1; |
1,006 | computer_student | multiset | Describe the year in program and in phase status for the student with most number in advisor. | student refers to advisedBy.p_id; most number in advisor refers to max(count(p_id_dummy)) | SELECT T2.yearsInProgram, T2.inPhase FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 1 |
1,024 | computer_student | multiset | How many professors teaches no more than two high-level or harder undergraduate courses? | professors refers to taughtBy.p_id; high-level or harder undergraduate courses refers to courseLevel = 'Level_400' ; no more than two refers to count(taughtBy.course_id) < = 2 | SELECT COUNT(*)
FROM (
SELECT p.`p_id`
FROM `person` AS p
LEFT JOIN `taughtBy` AS tb ON p.`p_id` = tb.`p_id`
LEFT JOIN `course` AS c
ON tb.`course_id` = c.`course_id`
AND c.`courseLevel` = 'Level_400'
WHERE p.`professor` = 1
GROUP BY p.`p_id`
HAVING COUNT(DISTINCT c.`c... |
1,025 | computer_student | multiset | Among the faculty employee professors, how many teaches high-level or harder undergraduate courses? | faculty employee professors refers to hasPosition = 'Faculty_eme' and professor = 1; high-level or harder undergraduate courses refers to courseLevel = 'Level_400'; professors unique identifying number refers to person.p_id | SELECT COUNT(DISTINCT T1.`p_id`) AS num_professors
FROM `person` AS T1
JOIN `taughtBy` AS T2 ON T1.`p_id` = T2.`p_id`
JOIN `course` AS T3 ON T3.`course_id` = T2.`course_id`
WHERE T1.`hasPosition` = 'Faculty_eme'
AND T1.`professor` = 1
AND T3.`courseLevel` = 'Level_400'; |
1,027 | computer_student | multiset | What year in the program do the students with more than 2 advisors are in? | students refers to student = 1; more than 2 advisors refers to count(p_id_dummy) > 2 | SELECT T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 GROUP BY T2.p_id HAVING COUNT(T2.p_id) > 2 |
1,028 | computer_student | multiset | How many professors teaches basic or medium undergraduate courses? | professors refers to taughtBy.p_id; basic or medium undergraduate courses refers to couresLevel = 'Level_300' | SELECT COUNT(DISTINCT tb.`p_id`)
FROM `taughtBy` AS tb
JOIN `course` AS c ON c.`course_id` = tb.`course_id`
JOIN `person` AS p ON p.`p_id` = tb.`p_id`
WHERE c.`courseLevel` = 'Level_300'
AND p.`professor` = 1; |
1,029 | computer_student | multiset | Among the students being advised by advisors, which students' year in the program do the advisors advise the majority of? | students refers to student = 1; students' year in the program do the advisors advise the majority of refers to max(count(yearsInProgram)) | SELECT `yearsInProgram`
FROM `person`
WHERE `student` = 1
AND `p_id` IN (SELECT `p_id` FROM `advisedBy`)
GROUP BY `yearsInProgram`
ORDER BY COUNT(*) DESC
LIMIT 1; |
1,036 | computer_student | multiset | Which professor taught the most courses and what is the position of this person in the university? | professor refers to taughtBy.p_id; most courses refers to max(taughtBy.p_id); position refers to hasPosition | SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1 |
1,547 | car_retails | multiset | What was the total price of the products shipped to Rovelli Gifts Distributors Ltd. between 1/1/2003 and 12/31/2003? | Mini Gifts Distributors Ltd. Is the customer name; shippedDate between '2003-01-01' and '2003-12-31'; total price = MULTIPLY(quantityOrdered, priceEach); | SELECT SUM(od.quantityOrdered * od.priceEach) AS total_price
FROM customers c
JOIN orders o ON c.customerNumber = o.customerNumber
JOIN orderdetails od ON o.orderNumber = od.orderNumber
WHERE c.customerName = 'Rovelli Gifts'
AND date(o.shippedDate) BETWEEN '2003-01-01' AND '2003-12-31' AND o.status = 'Shipped... |
1,554 | car_retails | multiset | How many customers have a credit limit of not more than 100,000 and which customer made the highest total payment amount for the year 2004? | creditLimit < = 100000; total payment amount refers to amount; highest total payment amount refers to MAX(amount); year(paymentDate) = '2004'; | SELECT (SELECT COUNT(*)
FROM `customers`
WHERE `creditLimit` <= 100000) AS customers_with_low_credit,
(
SELECT c.`customerName`
FROM `customers` c
JOIN `payments` p ON c.`customerNumber` = p.`customerNumber`
WH... |
1,565 | car_retails | multiset | Please list different customer names who have a single payment amount of over 50,000. | amount > 50000; | SELECT DISTINCT T2.customerName FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.amount > 50000 |
1,566 | car_retails | multiset | Please calculate the total payment amount of customers who come from the USA. | USA is a country; total amount payment refers to SUM(amount); | SELECT SUM(T1.amount) FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.country = 'USA' |
1,568 | car_retails | set | Please list the name and phone number of the customer whose order was cancelled. | cancelled order refers to status = 'Cancelled'; | SELECT T2.customerName, T2.phone FROM orders AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.status = 'Cancelled' |
1,573 | car_retails | multiset | State the email of those who are staff of Murphy Diane whose number is 1002 and living in San Francisco | staff of refers to reportsTO; San Francisco is a city; | SELECT T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T1.reportsTo = 1002 AND T2.city = 'San Francisco' |
1,576 | car_retails | multiset | How many employees who are living in Australia and have at least one customer whose credit limit is under 200000? | Australia is a country; creditLimit < 20000; | SELECT COUNT(*) AS num_employees
FROM (
SELECT DISTINCT e.`employeeNumber`
FROM `employees` e
JOIN `offices` o ON e.`officeCode` = o.`officeCode`
JOIN `customers` c ON c.`salesRepEmployeeNumber` = e.`employeeNumber`
WHERE o.`country` = 'Australia'
AND c.`creditLimit` < 200000
) sub; |
1,578 | car_retails | multiset | How many Australian customers who have credit line under 220000? | Australian is a nationality of country = 'Australia'; credit line refers to creditLimit; creditLimit < 220000; | SELECT COUNT(creditLimit) FROM customers WHERE creditLimit < 220000 AND country = 'Australia' |
1,582 | car_retails | set | State the emails of UK Sales Rep whose customers have top three highest credit limit | UK is a country; Sales Rep is a job title; | WITh customers_uk AS (SELECT T1.salesRepEmployeeNumber FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T2.jobTitle = 'Sales Rep' AND T1.country = 'UK' ORDER BY T1.creditLimit DESC LIMIT 3)
SELECT DISTINCT T2.email FROm customers_uk T1 JOIN employees T2 ON T1.salesR... |
1,583 | car_retails | multiset | How many customers who are in Norway and have credit line under 220000? | Norway is a country; credit line refers to creditLimit; creditLimit<220000; | SELECT COUNT(creditLimit) FROM customers WHERE creditLimit < 220000 AND country = 'Norway' |
1,584 | car_retails | multiset | List out full name and email of employees who are working in Paris? | full name = firstName, LastName; Paris is a city; | SELECT T1.firstName, T1.lastName, T1.email FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Paris' |
1,608 | car_retails | multiset | Calculate the total quantity ordered for 18th Century Vintage Horse Carriage and the average price weighted by quantity. | 18th Century Vintage Horse Carriage is a product name; average price weighted by quantity = SUM(quantity * priceEach) / SUM(quantity); | SELECT SUM(T2.quantityOrdered) , SUM(T2.quantityOrdered * T2.priceEach) / SUM(T2.quantityOrdered) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode WHERE T1.productName = '18th Century Vintage Horse Carriage' |
1,609 | car_retails | multiset | How many kinds of products did order No. 10252 contain? | Products refer to productCode; | SELECT COUNT(t.productCode) FROM orderdetails t WHERE t.orderNumber = '10252' |
1,615 | car_retails | multiset | What was the contact name for the check "NR157385"? | Contact name refers to contactFirstName and contactLastName | SELECT t2.contactFirstName, t2.contactLastName FROM payments AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t1.checkNumber = 'NR157385' |
1,620 | car_retails | multiset | How many French customers does Gerard Hernandez take care of? | Gerakd Hermandez is an employee; French customer refers to customer from France where country = 'France' | SELECT COUNT(t1.customerNumber) FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.country = 'France' AND t2.firstName = 'Gerard' AND t2.lastName = 'Hernandez' |
1,622 | car_retails | multiset | For the product No. S18_3482 in the Order No.10108, how much discount did the customer have? | discount refers to DIVIDE(SUBTRACT(MSRP, priceEach)), MSRP); product No. S18_3482 refers to productCode = 'S18_3482' | SELECT (t1.MSRP - t2.priceEach) / t1.MSRP FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode WHERE t1.productCode = 'S18_3482' AND t2.orderNumber = '10108' |
1,624 | car_retails | multiset | What's the email of the President of the company? | President refers to the jobTitle; | SELECT t.email FROM employees t WHERE t.jobTitle = 'President' |
1,625 | car_retails | multiset | Who is the sales representitive of Muscle Machine Inc? Please give the employee's full name. | Sales representative refers to jobTitle = 'Sales Rep'; Muscle Machine Inc is name of customer; | SELECT t2.firstName, t2.lastName FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t1.customerName = 'Muscle Machine Inc' |
1,626 | car_retails | multiset | If I'm from the Muscle Machine Inc, to which e-mail adress should I write a letter if I want to reach the superior of my sales representitive? | Muscle Machine Inc is name of customer; superior refers to 'reportsTO', who is the leader of the 'employeeNumber' | SELECT e_super.email
FROM customers AS c
JOIN employees AS e_rep ON c.salesRepEmployeeNumber = e_rep.employeeNumber
JOIN employees AS e_super ON e_rep.reportsTo = e_super.employeeNumber
WHERE c.customerName = 'Muscle Machine Inc'; |