Skip to content

Commit 73b6623

Browse files
wendy-awwongjingping
authored andcommitted
- L31: added multiple columns
- L56: modified SQL to result in non-empty df - L63: modified query to fit group_by category
1 parent 869090e commit 73b6623

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

data/questions_gen.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ How many courses are offered in each semester id?,"SELECT course_offering.semest
2828
How many courses have a final exam and how many do not?,"SELECT course_offering.has_final_exam, COUNT(*) AS num_courses FROM course_offering GROUP BY course_offering.has_final_exam;",advising,group_by
2929
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
3030
How many courses does each department offer?,"SELECT course.department, COUNT(DISTINCT course.course_id) AS num_courses FROM course GROUP BY course.department ORDER BY num_courses DESC NULLS LAST;",advising,group_by
31-
What is the average clarity score for each instructor who taught a course?,"SELECT instructor.name, AVG(comment_instructor.score) as average_score FROM comment_instructor JOIN instructor ON comment_instructor.instructor_id = instructor.instructor_id GROUP BY instructor.name ORDER BY average_score DESC NULLS LAST;",advising,group_by
31+
What is the average clarity score for each instructor who taught a course?,"SELECT {instructor.name, instructor.instructor_id}, AVG(comment_instructor.score) as average_score FROM comment_instructor JOIN instructor ON comment_instructor.instructor_id = instructor.instructor_id GROUP BY {} ORDER BY average_score DESC NULLS LAST;",advising,group_by
3232
"What is the total number of students enrolled in each course, ordered from highest to lowest?","SELECT {course.course_id, course.name}, SUM(course.num_enrolled) AS total_students FROM course GROUP BY {} ORDER BY total_students DESC NULLS LAST;",advising,order_by
3333
"Which course has the highest number of enrolled students, and what is the enrollment number?","SELECT {course.name, course.course_id}, course.num_enrolled FROM course ORDER BY course.num_enrolled DESC NULLS LAST LIMIT 1;",advising,order_by
3434
"What is the total number of credits earned by each student, ordered from highest to lowest? Give the student id and the total number of credits.","SELECT {student.student_id, student.lastname, student.firstname}, student.total_credit FROM student ORDER BY student.total_credit DESC NULLS LAST;",advising,order_by
@@ -53,14 +53,14 @@ What is the total cost of round-trip fares for each airline code?,"SELECT fare.f
5353
How many flights are there from each airport code?,"SELECT flight.from_airport, COUNT(*) AS number_of_flights FROM flight GROUP BY flight.from_airport ORDER BY number_of_flights ASC NULLS LAST;",atis,group_by
5454
"What is the average cost of a one-way trip for each fare id, sorted in ascending order?","SELECT fare.fare_id, AVG(fare.one_direction_cost) AS average_cost FROM fare GROUP BY fare.fare_id ORDER BY average_cost ASC NULLS LAST;",atis,group_by
5555
"How many meals are served in each compartment, sorted by the number of meals in descending order?","SELECT food_service.compartment, COUNT(food_service.meal_number) AS number_of_meals FROM food_service GROUP BY food_service.compartment ORDER BY number_of_meals DESC NULLS LAST;",atis,group_by
56-
"What is the average cost of round-trip fares from Los Angeles (LAX) to Chicago (ORD)?","SELECT AVG(fare.round_trip_cost) AS average_cost FROM fare WHERE fare.from_airport = 'LAX' AND fare.to_airport = 'ORD' GROUP BY fare.from_airport, fare.to_airport;",atis,group_by
56+
"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?","SELECT fare.fare_airline, AVG(fare.round_trip_cost) AS average_cost FROM fare WHERE fare.from_airport = 'LAX' AND fare.to_airport = 'ORD' GROUP BY fare.fare_airline ORDER BY average_cost DESC NULLS LAST;",atis,group_by
5757
Which aircraft code can carry the highest weight of cargo that any aircraft can carry?,"SELECT aircraft.aircraft_code FROM aircraft ORDER BY pay_load DESC NULLS LAST LIMIT 1;",atis,order_by
5858
"Which flight ids to Chicago (ORD) have the longest duration from departure to arrival, sorted in ascending order?","SELECT flight.flight_id, (flight.arrival_time - flight.departure_time) AS duration FROM flight WHERE to_airport = 'ORD' ORDER BY duration ASC NULLS LAST;",atis,order_by
5959
What are the top 2 airlines with the most flights?,"SELECT {airline.airline_name, airline.airline_code}, COUNT(flight.flight_id) AS number_of_flights FROM flight JOIN airline ON flight.airline_code = airline.airline_code GROUP BY {} ORDER BY number_of_flights DESC NULLS LAST LIMIT 2;",atis,order_by
6060
"Which airports have the shortest minimum connect time, sorted in ascending order?","SELECT {airport.airport_name, airport.airport_code}, airport.minimum_connect_time FROM airport ORDER BY airport.minimum_connect_time ASC NULLS LAST;",atis,order_by
6161
"What are the aircraft codes for all aircraft with a cruising speed of over 200 mph, sorted in ascending order?",SELECT aircraft.aircraft_code FROM aircraft WHERE aircraft.cruising_speed > 200 ORDER BY aircraft.aircraft_code ASC;,atis,order_by
6262
What is the ratio of one-way trip costs to round-trip costs for each fare?,"SELECT fare.fare_id, fare.one_direction_cost::float / NULLIF(fare.round_trip_cost, 0) AS cost_ratio FROM fare ORDER BY cost_ratio;",atis,ratio
63-
What is the ratio of the weight of all aircrafts to their maximum payload capacity?,"SELECT aircraft.weight::float / NULLIF(aircraft.pay_load, 0) AS weight_to_payload_ratio FROM aircraft;",atis,ratio
63+
What is the ratio of the maximum range to the maximum payload capacity for all aircraft?,"SELECT aircraft.range_miles::float / NULLIF(aircraft.pay_load, 0) AS range_to_payload_ratio FROM aircraft;",atis,ratio
6464
How does the ratio of the cruising speed to the payload of an aircraft vary across different aircraft manufacturers?,"SELECT aircraft.manufacturer, AVG(CAST(aircraft.cruising_speed AS FLOAT) / NULLIF(aircraft.pay_load, 0)) AS speed_payload_ratio FROM aircraft GROUP BY aircraft.manufacturer ORDER BY speed_payload_ratio DESC NULLS LAST;",atis,ratio
6565
What is the proportion of flights with stops out of all flights for each airline code?,"SELECT flight.airline_code, CAST(SUM(CASE WHEN flight.stops > 0 THEN 1 ELSE 0 END) AS FLOAT) / NULLIF(COUNT(*), 0) AS ratio FROM flight GROUP BY flight.airline_code;",atis,ratio
6666
What is the ratio of aircraft capacity to its range in miles for each aircraft code?,"SELECT aircraft.aircraft_code, CAST(aircraft.capacity AS FLOAT) / NULLIF(aircraft.range_miles, 0) AS capacity_range_ratio FROM aircraft;",atis,ratio

0 commit comments

Comments
 (0)