Skip to content

Commit

Permalink
revise 2 qn
Browse files Browse the repository at this point in the history
  • Loading branch information
wongjingping committed Jun 20, 2024
1 parent 0d50878 commit afc767f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/questions_gen_postgres.csv
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Which authors belong to the same domain as Martin?,"SELECT DISTINCT {a2.name, a2
Which authors are not part of any organization?,"SELECT DISTINCT {name, aid} FROM author WHERE oid IS NULL",academic,instruct,Always filter names using ILIKE
What are the publications written by authors from the 'Sociology' domain and presented at conferences in the year 2020?,"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 domain.name ILIKE '%Sociology%' AND publication.year = 2020 AND publication.cid = domain_conference.cid;",academic,instruct,"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."
"What are the names of the authors who have written publications in the domain ""Computer Science""?",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 domain.name ilike '%computer%science%';,academic,instruct,"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."
What month were most students admitted?,"SELECT date_trunc('month', s.admit_term) AS month, COUNT(*) AS total_students FROM student s GROUP BY MONTH ORDER BY total_students DESC LIMIT 1;",advising,date_functions,
"What month were most students admitted? Return the month as a date","SELECT date_trunc('month', s.admit_term) AS month, COUNT(*) AS total_students FROM student s GROUP BY MONTH ORDER BY total_students DESC LIMIT 1;",advising,date_functions,
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.,"SELECT DATE_TRUNC('month', s.predicted_graduation_semester - INTERVAL '2 weeks') AS month FROM student s ORDER BY s.predicted_graduation_semester DESC LIMIT 1;SELECT extract(MONTH FROM predicted_graduation_semester - interval '2 weeks') AS month FROM student ORDER BY predicted_graduation_semester DESC LIMIT 1;SELECT to_char(s.predicted_graduation_semester - interval '14 days', 'Month') AS MONTH FROM student s ORDER BY s.predicted_graduation_semester DESC LIMIT 1;",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,
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

0 comments on commit afc767f

Please sign in to comment.