Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify integer qns #197

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions data/questions_gen_bigquery.csv
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ academic,bigquery,instruct,SELECT DISTINCT author.name FROM academic.author JOIN
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 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? Give the answer as an integer.,
advising,bigquery,date_functions,SELECT DISTINCT co.course_id FROM advising.course_offering AS co JOIN advising.offering_instructor AS 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;,Return the course id's that are offered in either semesters 1 or 2 and ends before 1pm and had an instructor on thursday,
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?,
Expand Down Expand Up @@ -57,11 +57,11 @@ Use the student_record table for all information relating to students' choices a
advising,bigquery,instruct,"SELECT course.name, course.easiness_score FROM advising.course WHERE course.department = 'Computer Science';SELECT course.course_id, course.easiness_score FROM advising.course WHERE course.department = 'Computer Science';SELECT course.number, course.easiness_score FROM advising.course WHERE course.department = 'Computer Science';SELECT course.name, course.course_id, course.easiness_score FROM advising.course WHERE course.department = 'Computer Science';SELECT course.name, course.number, course.easiness_score FROM advising.course WHERE course.department = 'Computer Science';SELECT course.course_id, course.number, course.easiness_score FROM advising.course WHERE course.department = 'Computer Science';SELECT course.name, course.course_id, course.number, course.easiness_score FROM advising.course WHERE course.department = 'Computer Science';","What are the easiness scores for courses in the ""Computer Science"" department? Show both courses and scores.",Always filter names using exact string matching
advising,bigquery,instruct,"SELECT DISTINCT student_id FROM advising.student_record WHERE student_record.how = 'in-person' AND student_record.grade IN ('A', 'C');",Return the student IDs who have taken an in-person course and have gotten a grade of A or C.,"Always filter strings with an exact match.
When asked for specific students or courses, do not return duplicates."
atis,bigquery,date_functions,"SELECT flight.flight_number, (arrival_time - departure_time) / 60 AS duration_minutes FROM atis.flight ORDER BY duration_minutes NULLS LAST LIMIT 1;SELECT flight.flight_id, (arrival_time - departure_time) / 60 AS duration_minutes FROM atis.flight ORDER BY duration_minutes NULLS LAST LIMIT 1;SELECT flight.flight_number, flight.flight_id, (arrival_time - departure_time) / 60 AS duration_minutes FROM atis.flight ORDER BY duration_minutes NULLS LAST LIMIT 1;",Which flight has the shortest duration between departure and arrival times? Convert to minutes.,
atis,bigquery,date_functions,"SELECT flight.flight_number, (arrival_time - departure_time) / 60 AS duration_minutes FROM atis.flight ORDER BY duration_minutes NULLS LAST LIMIT 1;SELECT flight.flight_id, (arrival_time - departure_time) / 60 AS duration_minutes FROM atis.flight ORDER BY duration_minutes NULLS LAST LIMIT 1;SELECT flight.flight_number, flight.flight_id, (arrival_time - departure_time) / 60 AS duration_minutes FROM atis.flight ORDER BY duration_minutes NULLS LAST LIMIT 1;",Which flight has the shortest duration between departure and arrival times? Convert to integer minutes.,
atis,bigquery,date_functions,SELECT AVG(TIMESTAMP_SECONDS(arrival_time) - TIMESTAMP_SECONDS(departure_time) - INTERVAL '34' MINUTE) AS average_duration FROM atis.flight;SELECT AVG(arrival_time - departure_time) / 60 - 34 AS average_duration FROM atis.flight;,"What's the average duration between departure and arrival times minus 34 minutes? Convert from UNIX to regular datetime, and return the answer in minutes",
atis,bigquery,date_functions,"SELECT month.month_name, COUNT(*) AS departure_count FROM atis.flight JOIN atis.month ON EXTRACT(MONTH FROM TIMESTAMP_SECONDS(flight.departure_time)) = month.month_number GROUP BY month.month_name, month.month_number ORDER BY month.month_number NULLS LAST;SELECT TIMESTAMP_TRUNC(TIMESTAMP_SECONDS(flight.departure_time), MONTH) AS month, COUNT(*) AS num_departures FROM atis.flight GROUP BY MONTH ORDER BY MONTH NULLS LAST;",Count the number of flight departures for each month?,
atis,bigquery,date_functions,"SELECT FORMAT_TIMESTAMP('%H:%M', TIMESTAMP_SECONDS(MIN(departure_time))) AS earliest_departure_time FROM atis.flight;",What's the earliest flight departure time in the day in HH:MM?,
atis,bigquery,date_functions,"SELECT DATE_DIFF(CURRENT_DATE(), DATE(TIMESTAMP_SECONDS(MIN(departure_time))), DAY) AS difference_in_days FROM atis.flight;SELECT DATE_DIFF(CURRENT_DATE(), DATE(TIMESTAMP_SECONDS(MIN(f.departure_time))), DAY) AS days_difference FROM atis.flight AS f;",What's the absolute difference in time in days between today and the earliest flight departure?,
atis,bigquery,date_functions,"SELECT DATE_DIFF(CURRENT_DATE(), DATE(TIMESTAMP_SECONDS(MIN(departure_time))), DAY) AS difference_in_days FROM atis.flight;SELECT DATE_DIFF(CURRENT_DATE(), DATE(TIMESTAMP_SECONDS(MIN(f.departure_time))), DAY) AS days_difference FROM atis.flight AS f;",What's the absolute difference in time in days between today and the earliest flight departure? Give the answer as an integer.,
atis,bigquery,group_by,"SELECT fare.fare_airline, SUM(fare.round_trip_cost) AS total_round_trip_cost FROM atis.fare GROUP BY fare.fare_airline ORDER BY total_round_trip_cost DESC NULLS FIRST;",What is the total cost of round-trip fares for each airline code?,
atis,bigquery,group_by,"SELECT fare.fare_airline, AVG(fare.round_trip_cost) AS average_cost FROM atis.fare WHERE fare.from_airport = 'LAX' AND fare.to_airport = 'ORD' GROUP BY fare.fare_airline ORDER BY average_cost DESC;SELECT airline.airline_name, AVG(fare.round_trip_cost) AS avg_round_trip_cost FROM atis.fare JOIN atis.airline ON fare.fare_airline = airline.airline_code WHERE fare.from_airport = 'LAX' AND fare.to_airport = 'ORD' GROUP BY airline.airline_name ORDER BY avg_round_trip_cost DESC NULLS FIRST;","What is the average cost of round-trip fares from Los Angeles (LAX) to Chicago (ORD) for each airline, sorted in descending order by average cost?",
atis,bigquery,group_by,"SELECT f.from_airport, f.to_airport, AVG(f.one_direction_cost) AS average_cost FROM atis.fare AS f GROUP BY f.from_airport, f.to_airport ORDER BY f.from_airport NULLS LAST, f.to_airport NULLS LAST;",What is the average cost of a one-way trip for each airport pair in the fare table?,
Expand Down Expand Up @@ -232,6 +232,6 @@ ewallet,bigquery,date_functions,"WITH retail_merchants AS (SELECT mid FROM ewall
ewallet,bigquery,date_functions,"WITH earliest_coupons AS (SELECT c.merchant_id, MIN(c.start_date) AS earliest_coupon_start_date FROM ewallet.coupons AS c GROUP BY c.merchant_id) SELECT m.mid AS merchant_id, m.created_at AS merchant_registration_date, ec.earliest_coupon_start_date, c.cid AS earliest_coupon_id FROM ewallet.merchants AS m JOIN earliest_coupons AS ec ON m.mid = ec.merchant_id JOIN ewallet.coupons AS c ON ec.merchant_id = c.merchant_id AND ec.earliest_coupon_start_date = c.start_date WHERE ec.earliest_coupon_start_date <= m.created_at + INTERVAL '1' YEAR;","Which merchants earliest coupon start date was within a year of the merchant's registration? Return the merchant id, registration date, and earliest coupon id and start date",
car_dealership,bigquery,date_functions,"SELECT s.first_name, s.last_name, s.phone, s.termination_date - s.hire_date AS days_employed FROM car_dealership.salespersons AS s ORDER BY days_employed ASC NULLS LAST LIMIT 1;",Return the name and phone number of the salesperson with the shortest time from being hired to getting fired. Return the number of days he/she was employed for.,
car_dealership,bigquery,date_functions,"SELECT COUNT(*) AS weekend_payments FROM car_dealership.payments_made WHERE vendor_name = 'Utility Company' AND EXTRACT(DAYOFWEEK FROM payment_date) IN (1, 7);",Return the number of payments made on weekends to the vendor named 'Utility Company',
car_dealership,bigquery,date_functions,"SELECT payment_date, payment_method, SUM(payment_amount) AS total_amount FROM car_dealership.payments_received WHERE payment_date >= TIMESTAMP_TRUNC(CURRENT_DATE, WEEK) - INTERVAL '1' WEEK AND payment_date < TIMESTAMP_TRUNC(CURRENT_DATE, WEEK) GROUP BY payment_date, payment_method ORDER BY payment_date DESC NULLS FIRST, payment_method ASC NULLS LAST;","show me the daily total amount of payments received in the whole of the last ISO week, split by the payment_method",
car_dealership,bigquery,date_functions,"SELECT payment_date, payment_method, SUM(payment_amount) AS total_amount FROM car_dealership.payments_received WHERE payment_date >= TIMESTAMP_TRUNC(CURRENT_DATE, WEEK) - INTERVAL '1' WEEK AND payment_date < TIMESTAMP_TRUNC(CURRENT_DATE, WEEK) GROUP BY payment_date, payment_method ORDER BY payment_date DESC NULLS FIRST, payment_method ASC NULLS LAST;","show me the daily total amount of payments received in the whole of the previous ISO week not including the current week, split by the payment_method",
car_dealership,bigquery,date_functions,"WITH latest_snapshot AS (SELECT MAX(snapshot_date) AS snapshot_date FROM car_dealership.inventory_snapshots WHERE snapshot_date BETWEEN '2023-03-01' AND '2023-03-31'), latest_snapshot_data AS (SELECT inv.car_id FROM car_dealership.inventory_snapshots AS inv JOIN latest_snapshot AS ls ON inv.snapshot_date = ls.snapshot_date WHERE inv.is_in_inventory = TRUE) SELECT c.id, c.make, c.model, c.year FROM car_dealership.cars AS c JOIN latest_snapshot_data AS lsd ON c.id = lsd.car_id;","Which cars were in inventory in the latest snapshot for march 2023? Return the car id, make, model, and year.",
car_dealership,bigquery,date_functions,"SELECT TIMESTAMP_TRUNC(s.sale_date, QUARTER) AS QUARTER, c.state, SUM(s.sale_price) AS total_sales FROM car_dealership.sales AS s JOIN car_dealership.customers AS c ON s.customer_id = c.id WHERE EXTRACT(YEAR FROM s.sale_date) = 2023 GROUP BY c.state, QUARTER HAVING SUM(s.sale_price) > 0 ORDER BY QUARTER NULLS LAST, c.state NULLS LAST;",What were the total quarterly sales in 2023 grouped by customer's state? Represent each quarter as the first date in the quarter.,
Loading
Loading