Skip to content

Commit

Permalink
date diff from #172
Browse files Browse the repository at this point in the history
  • Loading branch information
wendy-aw authored and rishsriv committed Jun 20, 2024
1 parent 8edbebf commit 20c8530
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions data/questions_gen_mysql.csv
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ academic,mysql,instruct,"SELECT DISTINCT name FROM author WHERE oid IS NULL;SELE
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? 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 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 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 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 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 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?,
Expand Down
4 changes: 2 additions & 2 deletions data/questions_gen_sqlite.csv
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ academic,sqlite,instruct,"SELECT DISTINCT name FROM author WHERE oid IS NULL;SEL
academic,sqlite,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 LIKE."
academic,sqlite,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 LIKE."
advising,sqlite,date_functions,"SELECT strftime('%m', s.admit_term) AS month, COUNT(*) AS total_students FROM 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,sqlite,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,sqlite,date_functions,SELECT AVG(julianday(predicted_graduation_semester) - julianday(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,sqlite,date_functions,"SELECT COUNT(*) AS num_students_graduated FROM student WHERE predicted_graduation_semester >= DATE('now', '-10 years');",How many students were predicted to graduate in the last 10 years?,
advising,sqlite,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,sqlite,date_functions,SELECT ROUND(julianday(CURRENT_DATE) - julianday(MAX(admit_term))) AS duration_since_last_admitted_student FROM student s;,How long has it been in days since the last admitted student?,
advising,sqlite,date_functions,"SELECT strftime('%m', date(predicted_graduation_semester, '-14 days')) AS month FROM 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,sqlite,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,sqlite,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?,
Expand Down

0 comments on commit 20c8530

Please sign in to comment.