Skip to content

Commit

Permalink
Deleted academic's and scholar's date_functions questions.
Browse files Browse the repository at this point in the history
Updated some of the existing date_functions questions to use the actual date ranges in the data
Modified 1 question in advising to filter on time and day-of-week column since no other questions were testing for those columns in the advising schema.
  • Loading branch information
wongjingping authored and rishsriv committed Jun 24, 2024
1 parent 075bea4 commit 91b6748
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions data/questions_gen_postgres.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
question,query,db_name,query_category,instructions
Which conference published the most publications in the last 15 years? Give the conference name and publication count.,"SELECT conference.name, count(publication.pid) AS publication_count FROM publication JOIN conference ON publication.cid = conference.cid WHERE publication.year >= extract(YEAR FROM CURRENT_DATE) - 15 GROUP BY conference.name ORDER BY publication_count DESC LIMIT 1;",academic,date_functions,
How many publications were published between 2019 and 2021?,SELECT count(DISTINCT publication.pid) FROM publication WHERE publication.year BETWEEN 2019 AND 2021;,academic,date_functions,
What is the average number of citations received by publications in the last 5 years?,SELECT avg(publication.citation_num) FROM publication WHERE publication.year >= extract(YEAR FROM CURRENT_DATE) - 5;,academic,date_functions,
Which authors have published papers in journals within the past 20 years?,"SELECT DISTINCT {author.name, author.aid} FROM author JOIN writes ON author.aid = writes.aid JOIN publication ON writes.pid = publication.pid WHERE publication.year >= extract(YEAR FROM CURRENT_DATE) - 20;",academic,date_functions,
What's the difference in time between the first and last paper published?,SELECT max(YEAR) - min(YEAR) AS time_difference FROM publication;,academic,date_functions,
"Which authors have written publications in both the domain ""Machine Learning"" and the domain ""Data Science""?","SELECT {author.name,author.aid} FROM author WHERE author.aid IN (SELECT domain_author.aid FROM domain_author WHERE domain_author.did IN (SELECT domain.did FROM DOMAIN WHERE domain.name IN ('Machine Learning', 'Data Science') ) GROUP BY 1 HAVING COUNT(DISTINCT domain_author.did) = 2);",academic,group_by,
What is the total number of citations received by each author?,"SELECT {author.name, author.aid}, sum(publication.citation_num) AS total_citations FROM author JOIN writes ON author.aid = writes.aid JOIN publication ON writes.pid = publication.pid GROUP BY {} ORDER BY total_citations DESC NULLS LAST;SELECT {a.aid, a.name}, COUNT(c.cited) AS total_citations FROM author a JOIN writes w ON a.aid = w.aid JOIN publication p ON w.pid = p.pid JOIN cite c ON p.pid = c.cited GROUP BY {} ORDER BY total_citations DESC;",academic,group_by,
What is the total number of publications published in each year?,"SELECT publication.year, COUNT(DISTINCT publication.pid) AS total_publications FROM publication GROUP BY publication.year ORDER BY publication.year;",academic,group_by,
Expand Down Expand Up @@ -33,7 +28,7 @@ What are the publications written by authors from the 'Sociology' domain and pre
What's the average predicted time to graduation since admission in no. of days?,SELECT avg(predicted_graduation_semester - admit_term) AS average_predicted_time_to_graduation FROM student;,advising,date_functions,
How many students were predicted to graduate in the last 10 years?,"SELECT count(*) AS num_students_graduated FROM student WHERE predicted_graduation_semester >= DATE_TRUNC('year', CURRENT_DATE) - interval '10 year';",advising,date_functions,
How long has it been in days since the last admitted student?,SELECT CURRENT_DATE - max(admit_term) AS duration_since_last_admitted_student FROM student;,advising,date_functions,
Subtract 2 weeks from the most recent predicted graduation date and give the month as an integer.,"SELECT EXTRACT(MONTH FROM predicted_graduation_semester - interval '2 weeks') AS month FROM student ORDER BY predicted_graduation_semester DESC LIMIT 1;",advising,date_functions,
Return the course id's that are offered in either semesters 1 or 2 and ends before 1pm and had an instructor on thursday,"SELECT DISTINCT co.course_id FROM public.course_offering co JOIN public.offering_instructor oi ON co.offering_id = oi.offering_id WHERE (co.semester = 1 OR co.semester = 2) AND co.end_time < '13:00:00' AND co.thursday IS NOT NULL;",advising,date_functions,
What is the total number of students who found the instructor to be hilarious per course id?,"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;",advising,group_by,
What is the average clarity score for each instructor who taught a course?,"SELECT {i.name, i.instructor_id}, AVG(c.clarity_score) FROM course c JOIN course_offering co ON c.course_id = co.course_id JOIN offering_instructor oi ON co.offering_id = oi.offering_id JOIN instructor i ON oi.instructor_id = i.instructor_id GROUP BY {};",advising,group_by,
How many course offerings have a final exam and how many do not?,"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 co;",advising,group_by,
Expand Down Expand Up @@ -150,11 +145,6 @@ What's the name and rating of all the restaurants that have a rating greater tha
What's the name and food type of all the restaurants located on Market St in San Francisco?,"SELECT restaurant.name, restaurant.food_type FROM restaurant JOIN LOCATION ON restaurant.id = location.restaurant_id WHERE location.street_name ILIKE '%Market St%' AND location.city_name ILIKE '%San Francisco%';",restaurants,instruct,Match city_name and food_type case-insensitively. Match with ILIKE and percent sign for substring matching for all other string matches.
What are the names of the restaurants that serve Italian food?,SELECT restaurant.name FROM restaurant WHERE LOWER(restaurant.food_type) ILIKE '%italian%';,restaurants,instruct,Match city_name and food_type case-insensitively. Match with ILIKE and percent sign for substring matching for all other string matches.
What are the names of the restaurants in Los Angeles that have a rating higher than 4?,SELECT DISTINCT restaurant.name FROM restaurant WHERE restaurant.city_name ILIKE '%Los Angeles%' AND restaurant.rating > 4 ORDER BY restaurant.name NULLS LAST;,restaurants,instruct,Match city_name and food_type case-insensitively. Match with ILIKE and percent sign for substring matching for all other string matches.
How many authors have written a paper that was published 1 year or longer before today's date?,SELECT count(DISTINCT w.authorid) AS num_authors FROM paper p JOIN writes w ON p.paperid = w.paperid WHERE p.year < extract(YEAR FROM CURRENT_DATE - interval '1 year');,scholar,date_functions,
How many keyphrases are associated with papers published between 2020 and 2035?,SELECT count(DISTINCT pk.keyphraseid) AS num_keyphrases FROM paper p JOIN paperkeyphrase pk ON p.paperid = pk.paperid WHERE p.year >= 2020 AND p.year <= 2035 ;,scholar,date_functions,
What's the number of papers published per year excluding those published in the year that is 6 years before 2025?,"SELECT YEAR, count(*) AS num_papers FROM paper WHERE YEAR != 2025 - 6 GROUP BY YEAR ORDER BY YEAR;",scholar,date_functions,
Give me the total number of papers published in the first 12 months of 2019.,SELECT count(*) AS total_papers FROM paper WHERE YEAR = 2019;,scholar,date_functions,
"On average, how many papers per month were published in the whole of 2020?",SELECT cast(count(*) AS float)/ 12 AS average_papers_per_month FROM paper WHERE YEAR = 2020;,scholar,date_functions,
What is the total number of papers published per year?,"SELECT paper.year, COUNT(paper.paperid) AS total_papers FROM paper GROUP BY paper.year ORDER BY paper.year NULLS LAST;",scholar,group_by,
What is the total number of papers published in each year?,"SELECT paper.year, COUNT(paper.paperid) AS total_papers FROM paper GROUP BY paper.year ORDER BY paper.year;",scholar,group_by,
What is the total number of papers associated with each dataset?,"SELECT paperdataset.datasetid, COUNT(DISTINCT paperdataset.paperid) AS total_papers FROM paperdataset GROUP BY paperdataset.datasetid;SELECT dataset.datasetname, COUNT(paperdataset.paperid) AS total_papers FROM paperdataset JOIN dataset ON paperdataset.datasetid = dataset.datasetid GROUP BY dataset.datasetname;",scholar,group_by,
Expand All @@ -180,7 +170,7 @@ What is the proportion of papers that belong to more than 1 dataset to papers th
"How many papers were published in the journal ""nature"" in the year 2020?",SELECT COUNT(paper.paperid) FROM paper JOIN journal ON paper.journalid = journal.journalid WHERE paper.year = 2020 AND journal.journalname ILIKE '%nature%';,scholar,instruct,Filter strings with case-insensitive matching
"How many papers are associated with the keyphrase ""machine learning"" and were published in the journal named ""IEEE Transactions on Pattern Analysis and Machine Intelligence""?",SELECT COUNT(DISTINCT paper.paperid) FROM paper JOIN journal ON paper.journalid = journal.journalid JOIN paperkeyphrase ON paper.paperid = paperkeyphrase.paperid JOIN keyphrase ON paperkeyphrase.keyphraseid = keyphrase.keyphraseid WHERE keyphrase.keyphrasename ILIKE '%machine learning%' AND journal.journalname = 'IEEE Transactions on Pattern Analysis and Machine Intelligence';,scholar,instruct,"Filter paper names, journal names, using exact matches. Filter keyphrases with case-insensitive matching."
"How many authors wrote papers that were published in the journal ""Science"" in the year 2020?",SELECT COUNT(DISTINCT writes.authorid) AS number_of_authors FROM writes JOIN paper ON writes.paperid = paper.paperid JOIN journal ON paper.journalid = journal.journalid WHERE journal.journalname ILIKE '%Science%' AND paper.year = 2020;,scholar,instruct,Filter paper names using exact matches. Filter keyphrases and journal names with case-insensitive matching.
How many reviews were written for businesses located in California in the last 1000 months?,"SELECT count(*) AS review_count FROM review r JOIN business b ON r.business_id = b.business_id WHERE b.state = 'CA' AND (r.year * 12 + extract(MONTH FROM to_date(r.month, 'Month'))) >= (extract(YEAR FROM CURRENT_DATE) * 12 + extract(MONTH FROM CURRENT_DATE) - 1000) ;",yelp,date_functions,
How many reviews were written for businesses located in California in the last 10 months?,"SELECT count(*) AS review_count FROM review r JOIN business b ON r.business_id = b.business_id WHERE b.state = 'CA' AND (r.year * 12 + extract(MONTH FROM to_date(r.month, 'Month'))) >= (extract(YEAR FROM CURRENT_DATE) * 12 + extract(MONTH FROM CURRENT_DATE) - 10);",yelp,date_functions,
What is the total number of check-ins on the 2 days before Saturday?,"SELECT sum(COUNT) AS total_checkins FROM checkin WHERE DAY IN ('Thursday', 'Friday') ;",yelp,date_functions,
How many reviews were there 2 months before the review with id 3?,SELECT count(*) AS review_count FROM review WHERE (cast(review.year AS text) || '-' || review.month || '-01')::date = (SELECT (cast(r.year AS text) || '-' || r.month || '-01')::date - interval '2 months' FROM review r WHERE r.rid = 3) ;,yelp,date_functions,
What was the message that came with the tip made exactly 2 months after March 2021?,SELECT text AS message FROM tip WHERE MONTH ILIKE '%May%' AND YEAR = 2021 LIMIT 1;,yelp,date_functions,
Expand Down

0 comments on commit 91b6748

Please sign in to comment.