Skip to content

Commit

Permalink
Merge pull request #173 from defog-ai/jp/qn
Browse files Browse the repository at this point in the history
Revise 2 qn
  • Loading branch information
rishsriv authored Jun 20, 2024
2 parents 7ee50c4 + 2d502b0 commit e6c67b6
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
12 changes: 6 additions & 6 deletions data/questions_gen_bigquery.csv
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ academic,bigquery,table_join,"SELECT journal.name, COUNT(publication.pid) AS tot
academic,bigquery,table_join,"SELECT conference.name, COUNT(publication.pid) AS num_publications FROM academic.publication JOIN academic.conference ON publication.cid = conference.cid GROUP BY conference.name, conference.cid ORDER BY num_publications DESC;","How many publications were presented at each conference, ordered by the number of publications in descending order? Give the names of the conferences and their corresponding number of publications.",
academic,bigquery,table_join,SELECT COUNT(DISTINCT publication.pid) FROM academic.publication JOIN academic.journal ON publication.jid = journal.jid WHERE LOWER(journal.name) LIKE 'J%';,"How many publications were published in journals whose names start with the letter ""J""?",
academic,bigquery,instruct,"SELECT DISTINCT organization.name FROM academic.organization JOIN academic.author ON organization.oid = author.oid JOIN academic.writes ON author.aid = writes.aid JOIN academic.domain_publication ON writes.pid = domain_publication.pid JOIN academic.domain ON domain_publication.did = domain.did WHERE domain.name = 'Machine Learning';SELECT DISTINCT organization.oid FROM academic.organization JOIN academic.author ON organization.oid = author.oid JOIN academic.writes ON author.aid = writes.aid JOIN academic.domain_publication ON writes.pid = domain_publication.pid JOIN academic.domain ON domain_publication.did = domain.did WHERE domain.name = 'Machine Learning';SELECT DISTINCT organization.name, organization.oid FROM academic.organization JOIN academic.author ON organization.oid = author.oid JOIN academic.writes ON author.aid = writes.aid JOIN academic.domain_publication ON writes.pid = domain_publication.pid JOIN academic.domain ON domain_publication.did = domain.did WHERE domain.name = 'Machine Learning';","Which organizations have authors who have written publications in the domain ""Machine Learning""?",Always filter names using an exact match
academic,bigquery,instruct,"SELECT DISTINCT a2.name FROM academic.author AS a1 JOIN academic.domain_author AS da1 ON a1.aid = da1.aid JOIN academic.domain_author AS da2 ON da1.did = da2.did JOIN academic.author AS a2 ON da2.aid = a2.aid WHERE LOWER(LOWER(a1.name)) LIKE '%martin%';SELECT DISTINCT a2.aid FROM academic.author AS a1 JOIN academic.domain_author AS da1 ON a1.aid = da1.aid JOIN academic.domain_author AS da2 ON da1.did = da2.did JOIN academic.author AS a2 ON da2.aid = a2.aid WHERE LOWER(LOWER(a1.name)) LIKE '%martin%';SELECT DISTINCT a2.name, a2.aid FROM academic.author AS a1 JOIN academic.domain_author AS da1 ON a1.aid = da1.aid JOIN academic.domain_author AS da2 ON da1.did = da2.did JOIN academic.author AS a2 ON da2.aid = a2.aid WHERE LOWER(LOWER(a1.name)) LIKE '%martin%';",Which authors belong to the same domain as Martin?,Always filter names using LIKE with percent sign wildcards
academic,bigquery,instruct,"SELECT DISTINCT name FROM academic.author WHERE oid IS NULL;SELECT DISTINCT aid FROM academic.author WHERE oid IS NULL;SELECT DISTINCT name, aid FROM academic.author WHERE oid IS NULL;",Which authors are not part of any organization?,Always filter names using LIKE
academic,bigquery,instruct,"SELECT DISTINCT publication.title FROM academic.domain JOIN academic.domain_author ON domain.did = domain_author.did JOIN academic.writes ON domain_author.aid = writes.aid JOIN academic.publication ON writes.pid = publication.pid JOIN academic.domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;SELECT DISTINCT publication.pid FROM academic.domain JOIN academic.domain_author ON domain.did = domain_author.did JOIN academic.writes ON domain_author.aid = writes.aid JOIN academic.publication ON writes.pid = publication.pid JOIN academic.domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;SELECT DISTINCT publication.pid, publication.title FROM academic.domain JOIN academic.domain_author ON domain.did = domain_author.did JOIN academic.writes ON domain_author.aid = writes.aid JOIN academic.publication ON writes.pid = publication.pid JOIN academic.domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;",What are the publications written by authors from the 'Sociology' domain and presented at conferences in the year 2020?,"To get publications written by authors from a given domain, you would need to join domain, domain_author, author to link the domain to the author first, and then join with write to link with the publication id. Finally, to see which ones were presented at conferences, you must join the domain table with the domain_conference table. You must also filter names using LIKE."
academic,bigquery,instruct,SELECT DISTINCT author.name FROM academic.author JOIN academic.writes ON author.aid = writes.aid JOIN academic.publication ON writes.pid = publication.pid JOIN academic.domain_publication ON publication.pid = domain_publication.pid JOIN academic.domain ON domain_publication.did = domain.did WHERE LOWER(domain.name) LIKE '%computer%science%';,"What are the names of the authors who have written publications in the domain ""Computer Science""?","To get publications written by authors from a given domain, you would need to join domain, domain_author, author to link the domain to the author first, and then join with write to link with the publication id. You must also filter names using LIKE."
advising,bigquery,date_functions,"SELECT TIMESTAMP_TRUNC(s.admit_term, MONTH) AS month, COUNT(*) AS total_students FROM advising.student AS s GROUP BY MONTH ORDER BY total_students DESC NULLS FIRST LIMIT 1;",What month were most students admitted?,
academic,bigquery,instruct,"SELECT DISTINCT a2.name FROM academic.author AS a1 JOIN academic.domain_author AS da1 ON a1.aid = da1.aid JOIN academic.domain_author AS da2 ON da1.did = da2.did JOIN academic.author AS a2 ON da2.aid = a2.aid WHERE LOWER(LOWER(a1.name)) LIKE '%martin%';SELECT DISTINCT a2.aid FROM academic.author AS a1 JOIN academic.domain_author AS da1 ON a1.aid = da1.aid JOIN academic.domain_author AS da2 ON da1.did = da2.did JOIN academic.author AS a2 ON da2.aid = a2.aid WHERE LOWER(LOWER(a1.name)) LIKE '%martin%';SELECT DISTINCT a2.name, a2.aid FROM academic.author AS a1 JOIN academic.domain_author AS da1 ON a1.aid = da1.aid JOIN academic.domain_author AS da2 ON da1.did = da2.did JOIN academic.author AS a2 ON da2.aid = a2.aid WHERE LOWER(LOWER(a1.name)) LIKE '%martin%';",Which authors belong to the same domain as Martin?,Always filter names using ILIKE with percent sign wildcards
academic,bigquery,instruct,"SELECT DISTINCT name FROM academic.author WHERE oid IS NULL;SELECT DISTINCT aid FROM academic.author WHERE oid IS NULL;SELECT DISTINCT name, aid FROM academic.author WHERE oid IS NULL;",Which authors are not part of any organization?,Always filter names using ILIKE
academic,bigquery,instruct,"SELECT DISTINCT publication.title FROM academic.domain JOIN academic.domain_author ON domain.did = domain_author.did JOIN academic.writes ON domain_author.aid = writes.aid JOIN academic.publication ON writes.pid = publication.pid JOIN academic.domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;SELECT DISTINCT publication.pid FROM academic.domain JOIN academic.domain_author ON domain.did = domain_author.did JOIN academic.writes ON domain_author.aid = writes.aid JOIN academic.publication ON writes.pid = publication.pid JOIN academic.domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;SELECT DISTINCT publication.pid, publication.title FROM academic.domain JOIN academic.domain_author ON domain.did = domain_author.did JOIN academic.writes ON domain_author.aid = writes.aid JOIN academic.publication ON writes.pid = publication.pid JOIN academic.domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;",What are the publications written by authors from the 'Sociology' domain and presented at conferences in the year 2020?,"To get publications written by authors from a given domain, you would need to join domain, domain_author, author to link the domain to the author first, and then join with write to link with the publication id. Finally, to see which ones were presented at conferences, you must join the domain table with the domain_conference table. You must also filter names using ILIKE."
academic,bigquery,instruct,SELECT DISTINCT author.name FROM academic.author JOIN academic.writes ON author.aid = writes.aid JOIN academic.publication ON writes.pid = publication.pid JOIN academic.domain_publication ON publication.pid = domain_publication.pid JOIN academic.domain ON domain_publication.did = domain.did WHERE LOWER(domain.name) LIKE '%computer%science%';,"What are the names of the authors who have written publications in the domain ""Computer Science""?","To get publications written by authors from a given domain, you would need to join domain, domain_author, author to link the domain to the author first, and then join with write to link with the publication id. You must also filter names using ILIKE."
advising,bigquery,date_functions,"SELECT TIMESTAMP_TRUNC(s.admit_term, MONTH) AS month, COUNT(*) AS total_students FROM advising.student AS s GROUP BY MONTH ORDER BY total_students DESC NULLS FIRST LIMIT 1;","What month were most students admitted? Return the month as a date",
advising,bigquery,date_functions,SELECT AVG(predicted_graduation_semester - admit_term) AS average_predicted_time_to_graduation FROM advising.student;,What's the average predicted time to graduation since admission in no. of days?,
advising,bigquery,date_functions,"SELECT COUNT(*) AS num_students_graduated FROM advising.student WHERE predicted_graduation_semester >= TIMESTAMP_TRUNC(CURRENT_DATE, YEAR) - INTERVAL '10' YEAR;",How many students were predicted to graduate in the last 10 years?,
advising,bigquery,date_functions,SELECT CURRENT_DATE - MAX(admit_term) AS duration_since_last_admitted_student FROM advising.student;,How long has it been in days since the last admitted student?,
advising,bigquery,date_functions,"SELECT TIMESTAMP_TRUNC(s.predicted_graduation_semester - INTERVAL '2' WEEK, MONTH) AS month FROM advising.student AS s ORDER BY s.predicted_graduation_semester DESC NULLS FIRST LIMIT 1;SELECT EXTRACT(MONTH FROM predicted_graduation_semester - INTERVAL '2' WEEK) AS month FROM advising.student ORDER BY predicted_graduation_semester DESC NULLS FIRST LIMIT 1;",Subtract 2 weeks from the most recent predicted graduation date and give the month.,
advising,bigquery,date_functions,"SELECT EXTRACT(MONTH FROM predicted_graduation_semester - INTERVAL '2' WEEK) AS month FROM advising.student ORDER BY predicted_graduation_semester DESC NULLS FIRST LIMIT 1;",Subtract 2 weeks from the most recent predicted graduation date and give the month as an integer.,
advising,bigquery,group_by,"SELECT course_tags_count.course_id, SUM(course_tags_count.hilarious) AS total_hilarious FROM advising.course_tags_count GROUP BY course_tags_count.course_id;",What is the total number of students who found the instructor to be hilarious per course id?,
advising,bigquery,group_by,"SELECT i.name, AVG(c.clarity_score) FROM advising.course AS c JOIN advising.course_offering AS co ON c.course_id = co.course_id JOIN advising.offering_instructor AS oi ON co.offering_id = oi.offering_id JOIN advising.instructor AS i ON oi.instructor_id = i.instructor_id GROUP BY i.name;SELECT i.instructor_id, AVG(c.clarity_score) FROM advising.course AS c JOIN advising.course_offering AS co ON c.course_id = co.course_id JOIN advising.offering_instructor AS oi ON co.offering_id = oi.offering_id JOIN advising.instructor AS i ON oi.instructor_id = i.instructor_id GROUP BY i.instructor_id;SELECT i.name, i.instructor_id, AVG(c.clarity_score) FROM advising.course AS c JOIN advising.course_offering AS co ON c.course_id = co.course_id JOIN advising.offering_instructor AS oi ON co.offering_id = oi.offering_id JOIN advising.instructor AS i ON oi.instructor_id = i.instructor_id GROUP BY i.name, i.instructor_id;",What is the average clarity score for each instructor who taught a course?,
advising,bigquery,group_by,"SELECT course_offering.has_final_exam, COUNT(offering_id) AS num_courses FROM advising.course_offering GROUP BY course_offering.has_final_exam;SELECT COUNT(CASE WHEN co.has_final_exam THEN 1 END) AS num_with_final_exam, COUNT(CASE WHEN NOT co.has_final_exam THEN 1 END) AS num_without_final_exam FROM advising.course_offering AS co;",How many course offerings have a final exam and how many do not?,
Expand Down
8 changes: 4 additions & 4 deletions data/questions_gen_mysql.csv
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ academic,mysql,instruct,"SELECT DISTINCT a2.name FROM author AS a1 JOIN domain_a
academic,mysql,instruct,"SELECT DISTINCT name FROM author WHERE oid IS NULL;SELECT DISTINCT aid FROM author WHERE oid IS NULL;SELECT DISTINCT name, aid FROM author WHERE oid IS NULL",Which authors are not part of any organization?,Always filter names using ILIKE
academic,mysql,instruct,"SELECT DISTINCT publication.title FROM DOMAIN JOIN domain_author ON domain.did = domain_author.did JOIN writes ON domain_author.aid = writes.aid JOIN publication ON writes.pid = publication.pid JOIN domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%Sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;SELECT DISTINCT publication.pid FROM DOMAIN JOIN domain_author ON domain.did = domain_author.did JOIN writes ON domain_author.aid = writes.aid JOIN publication ON writes.pid = publication.pid JOIN domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%Sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;SELECT DISTINCT publication.title, publication.pid FROM DOMAIN JOIN domain_author ON domain.did = domain_author.did JOIN writes ON domain_author.aid = writes.aid JOIN publication ON writes.pid = publication.pid JOIN domain_conference ON domain.did = domain_conference.did WHERE LOWER(domain.name) LIKE '%Sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid",What are the publications written by authors from the 'Sociology' domain and presented at conferences in the year 2020?,"To get publications written by authors from a given domain, you would need to join domain, domain_author, author to link the domain to the author first, and then join with write to link with the publication id. Finally, to see which ones were presented at conferences, you must join the domain table with the domain_conference table. You must also filter names using ILIKE."
academic,mysql,instruct,SELECT DISTINCT author.name FROM author JOIN writes ON author.aid = writes.aid JOIN publication ON writes.pid = publication.pid JOIN domain_publication ON publication.pid = domain_publication.pid JOIN domain ON domain_publication.did = domain.did WHERE LOWER(domain.name) LIKE '%computer%science%',"What are the names of the authors who have written publications in the domain ""Computer Science""?","To get publications written by authors from a given domain, you would need to join domain, domain_author, author to link the domain to the author first, and then join with write to link with the publication id. You must also filter names using ILIKE."
advising,mysql,date_functions,"SELECT DATE_FORMAT(s.admit_term, '%Y-%m') AS month, COUNT(*) AS total_students FROM advising.student AS s GROUP BY month ORDER BY total_students DESC LIMIT 1",What month were most students admitted?,
advising,mysql,date_functions,"SELECT AVG(DATEDIFF(predicted_graduation_semester, admit_term)) AS average_predicted_time_to_graduation FROM student;",What's the average predicted time to graduation since admission in no. of days?,
advising,mysql,date_functions,"SELECT DATE_FORMAT(s.admit_term, '%Y-%m') AS month, COUNT(*) AS total_students FROM advising.student AS s GROUP BY month ORDER BY total_students DESC LIMIT 1","What month were most students admitted? Return the month as a date",
advising,mysql,date_functions,SELECT AVG(predicted_graduation_semester - admit_term) AS average_predicted_time_to_graduation FROM student,What's the average predicted time to graduation since admission in no. of days?,
advising,mysql,date_functions,"SELECT COUNT(*) AS num_students_graduated FROM advising.student WHERE predicted_graduation_semester >= DATE_SUB(CURDATE(), INTERVAL 10 YEAR);",How many students were predicted to graduate in the last 10 years?,
advising,mysql,date_functions,"SELECT DATEDIFF(CURRENT_DATE, MAX(admit_term)) AS duration_since_last_admitted_student FROM student;",How long has it been in days since the last admitted student?,
advising,mysql,date_functions,"SELECT MONTH(DATE_SUB(s.predicted_graduation_semester, INTERVAL 2 WEEK)) AS month FROM advising.student AS s ORDER BY s.predicted_graduation_semester DESC LIMIT 1;SELECT EXTRACT(MONTH FROM DATE_SUB(predicted_graduation_semester, INTERVAL 2 WEEK)) AS month FROM advising.student ORDER BY CASE WHEN predicted_graduation_semester IS NULL THEN 1 ELSE 0 END DESC, predicted_graduation_semester DESC LIMIT 1",Subtract 2 weeks from the most recent predicted graduation date and give the month.,
advising,mysql,date_functions,SELECT CURRENT_DATE - MAX(admit_term) AS duration_since_last_admitted_student FROM student,How long has it been in days since the last admitted student?,
advising,mysql,date_functions,"SELECT EXTRACT(MONTH FROM DATE_SUB(predicted_graduation_semester, INTERVAL 2 WEEK)) AS month FROM advising.student ORDER BY CASE WHEN predicted_graduation_semester IS NULL THEN 1 ELSE 0 END DESC, predicted_graduation_semester DESC LIMIT 1",Subtract 2 weeks from the most recent predicted graduation date and give the month as an integer.,
advising,mysql,group_by,"SELECT course_tags_count.course_id, SUM(course_tags_count.hilarious) AS total_hilarious FROM course_tags_count GROUP BY course_tags_count.course_id",What is the total number of students who found the instructor to be hilarious per course id?,
advising,mysql,group_by,"SELECT i.name, AVG(c.clarity_score) FROM course AS c JOIN course_offering AS co ON c.course_id = co.course_id JOIN offering_instructor AS oi ON co.offering_id = oi.offering_id JOIN instructor AS i ON oi.instructor_id = i.instructor_id GROUP BY i.name;SELECT i.instructor_id, AVG(c.clarity_score) FROM course AS c JOIN course_offering AS co ON c.course_id = co.course_id JOIN offering_instructor AS oi ON co.offering_id = oi.offering_id JOIN instructor AS i ON oi.instructor_id = i.instructor_id GROUP BY i.instructor_id;SELECT i.name, i.instructor_id, AVG(c.clarity_score) FROM course AS c JOIN course_offering AS co ON c.course_id = co.course_id JOIN offering_instructor AS oi ON co.offering_id = oi.offering_id JOIN instructor AS i ON oi.instructor_id = i.instructor_id GROUP BY i.name, i.instructor_id",What is the average clarity score for each instructor who taught a course?,
advising,mysql,group_by,"SELECT course_offering.has_final_exam, COUNT(offering_id) AS num_courses FROM course_offering GROUP BY course_offering.has_final_exam;SELECT COUNT(CASE WHEN co.has_final_exam THEN 1 END) AS num_with_final_exam, COUNT(CASE WHEN NOT co.has_final_exam THEN 1 END) AS num_without_final_exam FROM course_offering AS co",How many course offerings have a final exam and how many do not?,
Expand Down
Loading

0 comments on commit e6c67b6

Please sign in to comment.