query_id
int64 0
2.15k
| database_id
stringclasses 40
values | table_id
listlengths 1
4
| query
stringlengths 22
185
| answer
stringlengths 22
608
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
400 |
vehicle_rent
|
[
"vehicles"
] |
What are the different types of powertrains?
|
SELECT DISTINCT type_of_powertrain FROM vehicles
|
easy
|
401 |
vehicle_rent
|
[
"vehicles"
] |
Show name, type of powertrain, and annual fuel cost for all vehicles with model year 2013 or 2014.
|
SELECT name , type_of_powertrain , annual_fuel_cost FROM vehicles WHERE model_year = 2013 OR model_year = 2014
|
extra
|
402 |
vehicle_rent
|
[
"vehicles"
] |
What are the names, types of powertrains, and yearly fuel costs for vehicles with model years in either 2013 2014?
|
SELECT name , type_of_powertrain , annual_fuel_cost FROM vehicles WHERE model_year = 2013 OR model_year = 2014
|
extra
|
403 |
vehicle_rent
|
[
"vehicles"
] |
Show types of powertrain with vehicles both from 2014 and 2013.
|
SELECT type_of_powertrain FROM vehicles WHERE model_year = 2014 INTERSECT SELECT type_of_powertrain FROM vehicles WHERE model_year = 2013
|
hard
|
404 |
vehicle_rent
|
[
"vehicles"
] |
What are the types of powertrains that have vehicles that were made in both 2013 and 2014?
|
SELECT type_of_powertrain FROM vehicles WHERE model_year = 2014 INTERSECT SELECT type_of_powertrain FROM vehicles WHERE model_year = 2013
|
hard
|
405 |
vehicle_rent
|
[
"vehicles"
] |
Show all types of powertrain and the number of vehicles in each type.
|
SELECT type_of_powertrain , count(*) FROM vehicles GROUP BY type_of_powertrain
|
medium
|
406 |
vehicle_rent
|
[
"vehicles"
] |
How many vehicles have each type of powertrain?
|
SELECT type_of_powertrain , count(*) FROM vehicles GROUP BY type_of_powertrain
|
medium
|
407 |
vehicle_rent
|
[
"vehicles"
] |
What is the type of powertrain with most number of vehicles.
|
SELECT type_of_powertrain FROM vehicles GROUP BY type_of_powertrain ORDER BY count(*) DESC LIMIT 1
|
hard
|
408 |
vehicle_rent
|
[
"vehicles"
] |
Which type of powertrain is most common?
|
SELECT type_of_powertrain FROM vehicles GROUP BY type_of_powertrain ORDER BY count(*) DESC LIMIT 1
|
hard
|
409 |
vehicle_rent
|
[
"vehicles"
] |
Show minimum, maximum, and average annual fuel cost for all vehicles.
|
SELECT min(annual_fuel_cost) , max(annual_fuel_cost) , avg(annual_fuel_cost) FROM vehicles
|
medium
|
410 |
vehicle_rent
|
[
"vehicles"
] |
What are the minimum, maximum, and average annual fuel costs across all vehicles?
|
SELECT min(annual_fuel_cost) , max(annual_fuel_cost) , avg(annual_fuel_cost) FROM vehicles
|
medium
|
411 |
vehicle_rent
|
[
"vehicles"
] |
Show name and model year for vehicles with city fuel economy rate less than or equal to highway fuel economy rate.
|
SELECT name , model_year FROM vehicles WHERE city_fuel_economy_rate <= highway_fuel_economy_rate
|
medium
|
412 |
vehicle_rent
|
[
"vehicles"
] |
What are the names and model years for vehicles that have a city fuel economy rate less than or equal to its highway fuel economy rate?
|
SELECT name , model_year FROM vehicles WHERE city_fuel_economy_rate <= highway_fuel_economy_rate
|
medium
|
413 |
vehicle_rent
|
[
"vehicles"
] |
Show the type of powertrain with at least two vehicles, and the average annual fuel cost for vehicles in each such type.
|
SELECT type_of_powertrain , avg(annual_fuel_cost) FROM vehicles GROUP BY type_of_powertrain HAVING count(*) >= 2
|
medium
|
414 |
vehicle_rent
|
[
"vehicles"
] |
What are the types of powertrains for which there are two or more vehicles, and what are their average annual fuel costs?
|
SELECT type_of_powertrain , avg(annual_fuel_cost) FROM vehicles GROUP BY type_of_powertrain HAVING count(*) >= 2
|
medium
|
415 |
vehicle_rent
|
[
"customers"
] |
Show the name, age, membership credit for all customers?
|
SELECT name , age , membership_credit FROM customers
|
medium
|
416 |
vehicle_rent
|
[
"customers"
] |
What are the names, ages, and membership credits for all customers?
|
SELECT name , age , membership_credit FROM customers
|
medium
|
417 |
vehicle_rent
|
[
"customers"
] |
Show the name and age of the customer with maximum membership credit.
|
SELECT name , age FROM customers ORDER BY membership_credit DESC LIMIT 1
|
medium
|
418 |
vehicle_rent
|
[
"customers"
] |
What is the name and age of the customer with the most membership credit?
|
SELECT name , age FROM customers ORDER BY membership_credit DESC LIMIT 1
|
medium
|
419 |
vehicle_rent
|
[
"customers"
] |
What is the average age for customers with a membership credit above the average?
|
SELECT avg(age) FROM customers WHERE membership_credit > (SELECT avg(membership_credit) FROM customers)
|
hard
|
420 |
vehicle_rent
|
[
"customers"
] |
Return the average age for customers who have membership above the average across all customers.
|
SELECT avg(age) FROM customers WHERE membership_credit > (SELECT avg(membership_credit) FROM customers)
|
hard
|
421 |
vehicle_rent
|
[
"discount"
] |
Show all information for all discounts.
|
SELECT * FROM discount
|
easy
|
422 |
vehicle_rent
|
[
"discount"
] |
Return all information about discounts.
|
SELECT * FROM discount
|
easy
|
423 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
Show the name and total hours of renting for each vehicle.
|
SELECT T2.name , sum(T1.total_hours) FROM renting_history AS T1 JOIN vehicles AS T2 ON T1.vehicles_id = T2.id GROUP BY T2.id
|
medium
|
424 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
What are the names and total rental hours for each vehicle?
|
SELECT T2.name , sum(T1.total_hours) FROM renting_history AS T1 JOIN vehicles AS T2 ON T1.vehicles_id = T2.id GROUP BY T2.id
|
medium
|
425 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
Show the name of vehicles with no renting history.
|
SELECT name FROM vehicles WHERE id NOT IN (SELECT vehicles_id FROM renting_history)
|
hard
|
426 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
What are the names of vehicles that have never been rented?
|
SELECT name FROM vehicles WHERE id NOT IN (SELECT vehicles_id FROM renting_history)
|
hard
|
427 |
vehicle_rent
|
[
"customers",
"renting_history"
] |
Show the name of customer with at least two renting history records.
|
SELECT T2.name FROM renting_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.id GROUP BY T2.id HAVING count(*) >= 2
|
medium
|
428 |
vehicle_rent
|
[
"customers",
"renting_history"
] |
What are the names of customers who have two or more records of rental history?
|
SELECT T2.name FROM renting_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.id GROUP BY T2.id HAVING count(*) >= 2
|
medium
|
429 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
Show the name and model year of the vehicle with most number of renting history records.
|
SELECT T2.name , T2.model_year FROM renting_history AS T1 JOIN vehicles AS T2 ON T1.vehicles_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
|
extra
|
430 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
What is the name and model year of the vehicle which has been rented the most times?
|
SELECT T2.name , T2.model_year FROM renting_history AS T1 JOIN vehicles AS T2 ON T1.vehicles_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
|
extra
|
431 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
Show the vehicle name with a descending order of total hours of renting.
|
SELECT T2.name FROM renting_history AS T1 JOIN vehicles AS T2 ON T1.vehicles_id = T2.id GROUP BY T2.id ORDER BY sum(T1.total_hours) DESC
|
hard
|
432 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
What are the names of vehicles, sorted descending by total hours of renting?
|
SELECT T2.name FROM renting_history AS T1 JOIN vehicles AS T2 ON T1.vehicles_id = T2.id GROUP BY T2.id ORDER BY sum(T1.total_hours) DESC
|
hard
|
433 |
vehicle_rent
|
[
"renting_history",
"discount"
] |
What is the discount name with most number of renting history records?
|
SELECT T2.name FROM renting_history AS T1 JOIN discount AS T2 ON T1.discount_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
|
extra
|
434 |
vehicle_rent
|
[
"renting_history",
"discount"
] |
Return the name of the discount that corresponds to the most rental history records.
|
SELECT T2.name FROM renting_history AS T1 JOIN discount AS T2 ON T1.discount_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
|
extra
|
435 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
Find the name and powertrain type of the cars that rented for more than 30 total hours.
|
SELECT T2.name , T2.Type_of_powertrain FROM renting_history AS T1 JOIN vehicles AS T2 ON T1.vehicles_id = T2.id GROUP BY T1.vehicles_id HAVING sum(T1.total_hours) > 30
|
medium
|
436 |
vehicle_rent
|
[
"vehicles",
"renting_history"
] |
What are the names and powertrain types of cars that have more than 30 total rental hours?
|
SELECT T2.name , T2.Type_of_powertrain FROM renting_history AS T1 JOIN vehicles AS T2 ON T1.vehicles_id = T2.id GROUP BY T1.vehicles_id HAVING sum(T1.total_hours) > 30
|
medium
|
437 |
vehicle_rent
|
[
"vehicles"
] |
Find the average city and highway fuel rates for cars with different powertrain types.
|
SELECT avg(City_fuel_economy_rate) , avg(Highway_fuel_economy_rate) , Type_of_powertrain FROM vehicles GROUP BY Type_of_powertrain
|
medium
|
438 |
vehicle_rent
|
[
"vehicles"
] |
What are the average city fuel economy rate, average highway fuel economy rate for different types of powertrains?
|
SELECT avg(City_fuel_economy_rate) , avg(Highway_fuel_economy_rate) , Type_of_powertrain FROM vehicles GROUP BY Type_of_powertrain
|
medium
|
439 |
cre_Students_Information_Systems
|
[
"student_loans"
] |
What is the average amount of a student loan?
|
SELECT avg(amount_of_loan) FROM Student_Loans
|
easy
|
440 |
cre_Students_Information_Systems
|
[
"student_loans"
] |
Compute the average amount of student loans.
|
SELECT avg(amount_of_loan) FROM Student_Loans
|
easy
|
441 |
cre_Students_Information_Systems
|
[
"detention",
"classes",
"students"
] |
List the biographical data and student id for the students who take 2 or more classes and the students who have less than 2 detentions.
|
SELECT T1.bio_data , T1.student_id FROM Students AS T1 JOIN Classes AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING count(*) >= 2 UNION SELECT T1.bio_data , T1.student_id FROM Students AS T1 JOIN Detention AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING count(*) < 2
|
extra
|
442 |
cre_Students_Information_Systems
|
[
"detention",
"classes",
"students"
] |
What are the biographical data and student id of the students who either took two or more classes and or have less than two detentions?
|
SELECT T1.bio_data , T1.student_id FROM Students AS T1 JOIN Classes AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING count(*) >= 2 UNION SELECT T1.bio_data , T1.student_id FROM Students AS T1 JOIN Detention AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING count(*) < 2
|
extra
|
443 |
cre_Students_Information_Systems
|
[
"teachers",
"classes"
] |
List the details of the teachers who teach some class whose detail has the substring 'data' but do not teach a class whose detail contains the prefix 'net'
|
SELECT T1.teacher_details FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.class_details LIKE '%data%' EXCEPT SELECT T1.teacher_details FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.class_details LIKE 'net%'
|
extra
|
444 |
cre_Students_Information_Systems
|
[
"teachers",
"classes"
] |
Which teachers teach a class that has the substring 'data' in its detail but do not teach a class that has prefix 'net' in its detail? Give me the teacher details.
|
SELECT T1.teacher_details FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.class_details LIKE '%data%' EXCEPT SELECT T1.teacher_details FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.class_details LIKE 'net%'
|
extra
|
445 |
cre_Students_Information_Systems
|
[
"detention",
"student_loans",
"students"
] |
List the biographical data of the students who never had a detention or student loan .
|
select bio_data from students where student_id not in (select t1.student_id from students as t1 join detention as t2 on t1.student_id = t2.student_id union select t1.student_id from students as t1 join student_loans as t2 on t1.student_id = t2.student_id)
|
hard
|
446 |
cre_Students_Information_Systems
|
[
"detention",
"student_loans",
"students"
] |
Which students never had a detention or student loan ? Find their biographical data .
|
select bio_data from students where student_id not in (select t1.student_id from students as t1 join detention as t2 on t1.student_id = t2.student_id union select t1.student_id from students as t1 join student_loans as t2 on t1.student_id = t2.student_id)
|
hard
|
447 |
cre_Students_Information_Systems
|
[
"student_loans",
"achievements"
] |
What are the loan amounts and loan dates of the students who have at least 2 achievements?
|
SELECT amount_of_loan , date_of_loan FROM Student_Loans WHERE student_id IN ( SELECT student_id FROM Achievements GROUP BY student_id HAVING count(*) >= 2 )
|
extra
|
448 |
cre_Students_Information_Systems
|
[
"student_loans",
"achievements"
] |
List the amount and date of loan for the students who have two or more achievements.
|
SELECT amount_of_loan , date_of_loan FROM Student_Loans WHERE student_id IN ( SELECT student_id FROM Achievements GROUP BY student_id HAVING count(*) >= 2 )
|
extra
|
449 |
cre_Students_Information_Systems
|
[
"teachers",
"classes"
] |
List the detail and id of the teacher who teaches the most courses.
|
SELECT T1.teacher_details , T1.teacher_id FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id GROUP BY T1.teacher_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
450 |
cre_Students_Information_Systems
|
[
"teachers",
"classes"
] |
What are the detail and id of the teacher who teaches the largest number of courses?
|
SELECT T1.teacher_details , T1.teacher_id FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id GROUP BY T1.teacher_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
451 |
cre_Students_Information_Systems
|
[
"ref_detention_type",
"detention"
] |
What are the distinct descriptions of all the detentions which have ever happened?
|
SELECT distinct(T1.detention_type_description) FROM Ref_Detention_Type AS T1 JOIN Detention AS T2 ON T1.detention_type_code = T2.detention_type_code
|
easy
|
452 |
cre_Students_Information_Systems
|
[
"ref_detention_type",
"detention"
] |
Return the distinct descriptions of all the detentions that have happened.
|
SELECT distinct(T1.detention_type_description) FROM Ref_Detention_Type AS T1 JOIN Detention AS T2 ON T1.detention_type_code = T2.detention_type_code
|
easy
|
453 |
cre_Students_Information_Systems
|
[
"ref_address_types",
"students_addresses",
"students"
] |
List the personal details and the address type descriptions of all the students.
|
SELECT DISTINCT T1.student_details , T3.address_type_description FROM Students AS T1 JOIN Students_Addresses AS T2 ON T1.student_id = T2.student_id JOIN Ref_Address_Types AS T3 ON T2.address_type_code = T3.address_type_code
|
medium
|
454 |
cre_Students_Information_Systems
|
[
"ref_address_types",
"students_addresses",
"students"
] |
What are the personal details and the address type descriptions of each student?
|
SELECT DISTINCT T1.student_details , T3.address_type_description FROM Students AS T1 JOIN Students_Addresses AS T2 ON T1.student_id = T2.student_id JOIN Ref_Address_Types AS T3 ON T2.address_type_code = T3.address_type_code
|
medium
|
455 |
cre_Students_Information_Systems
|
[
"addresses",
"students_addresses",
"students"
] |
List the the address details and the biographical information of the students.
|
SELECT T1.address_details , T3.bio_data FROM Addresses AS T1 JOIN Students_Addresses AS T2 ON T1.address_id = T2.address_id JOIN Students AS T3 ON T2.student_id = T3.student_id
|
medium
|
456 |
cre_Students_Information_Systems
|
[
"addresses",
"students_addresses",
"students"
] |
What are the address details and biographical information of each student?
|
SELECT T1.address_details , T3.bio_data FROM Addresses AS T1 JOIN Students_Addresses AS T2 ON T1.address_id = T2.address_id JOIN Students AS T3 ON T2.student_id = T3.student_id
|
medium
|
457 |
cre_Students_Information_Systems
|
[
"transcripts",
"students"
] |
List the biographical data and the date of the transcript of all the students.
|
SELECT T1.bio_data , T2.date_of_transcript FROM Students AS T1 JOIN Transcripts AS T2 ON T1.student_id = T2.student_id
|
medium
|
458 |
cre_Students_Information_Systems
|
[
"transcripts",
"students"
] |
What are the biographical data and the date of transcript issuance of each student?
|
SELECT T1.bio_data , T2.date_of_transcript FROM Students AS T1 JOIN Transcripts AS T2 ON T1.student_id = T2.student_id
|
medium
|
459 |
cre_Students_Information_Systems
|
[
"behaviour_monitoring"
] |
How many students got the most common result in the behavioral monitoring details? Also list the result details.
|
SELECT count(DISTINCT student_id) , behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details ORDER BY count(*) DESC LIMIT 1
|
hard
|
460 |
cre_Students_Information_Systems
|
[
"behaviour_monitoring"
] |
Find the most common result in the behavioral monitoring details. What are the count and the details of this result?
|
SELECT count(DISTINCT student_id) , behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details ORDER BY count(*) DESC LIMIT 1
|
hard
|
461 |
cre_Students_Information_Systems
|
[
"behaviour_monitoring",
"students"
] |
Which students not only got the most common result but also got a result obtained by 3 students in behaviour monitoring? List the student's biographical data and details.
|
SELECT T1.bio_data , T1.student_details FROM Students AS T1 JOIN Behaviour_Monitoring AS T2 ON T1.student_id = T2.student_id WHERE T2.behaviour_monitoring_details IN ( SELECT behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details ORDER BY count(*) DESC LIMIT 1 ) INTERSECT SELECT T1.bio_data , T1.student_details FROM Students AS T1 JOIN Behaviour_Monitoring AS T2 ON T1.student_id = T2.student_id WHERE T2.behaviour_monitoring_details IN ( SELECT behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details HAVING count(*) = 3 )
|
extra
|
462 |
cre_Students_Information_Systems
|
[
"behaviour_monitoring",
"students"
] |
Find the biographical data and details of students who got not only the most common result but also a result that is obtained by 3 students in behaviour monitoring.
|
SELECT T1.bio_data , T1.student_details FROM Students AS T1 JOIN Behaviour_Monitoring AS T2 ON T1.student_id = T2.student_id WHERE T2.behaviour_monitoring_details IN ( SELECT behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details ORDER BY count(*) DESC LIMIT 1 ) INTERSECT SELECT T1.bio_data , T1.student_details FROM Students AS T1 JOIN Behaviour_Monitoring AS T2 ON T1.student_id = T2.student_id WHERE T2.behaviour_monitoring_details IN ( SELECT behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details HAVING count(*) = 3 )
|
extra
|
463 |
cre_Students_Information_Systems
|
[
"behaviour_monitoring",
"students"
] |
Which students only got the most common result for his or her all behaviour monitoring details? List the students' biographical information.
|
SELECT T1.bio_data FROM Students AS T1 JOIN Behaviour_Monitoring AS T2 ON T1.student_id = T2.student_id WHERE T2.behaviour_monitoring_details IN ( SELECT behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details ORDER BY count(*) DESC LIMIT 1 ) EXCEPT SELECT T1.bio_data FROM Students AS T1 JOIN Behaviour_Monitoring AS T2 ON T1.student_id = T2.student_id WHERE T2.behaviour_monitoring_details NOT IN ( SELECT behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details ORDER BY count(*) DESC LIMIT 1 )
|
extra
|
464 |
cre_Students_Information_Systems
|
[
"students",
"behaviour_monitoring"
] |
What is the biographical information of the students who got the most common result for their behaviour monitoring details ?
|
select t1.bio_data from students as t1 join behaviour_monitoring as t2 on t1.student_id = t2.student_id where t2.behaviour_monitoring_details in ( select behaviour_monitoring_details from behaviour_monitoring group by behaviour_monitoring_details order by count(*) desc limit 1 ) except select t1.bio_data from students as t1 join behaviour_monitoring as t2 on t1.student_id = t2.student_id where t2.behaviour_monitoring_details not in ( select behaviour_monitoring_details from behaviour_monitoring group by behaviour_monitoring_details order by count(*) desc limit 1 )
|
extra
|
465 |
cre_Students_Information_Systems
|
[
"student_events",
"students"
] |
Which students have gone through any event? List the students' biographical data and event date.
|
SELECT T1.bio_data , T2.event_date FROM Students AS T1 JOIN Student_Events AS T2 ON T1.student_id = T2.student_id
|
medium
|
466 |
cre_Students_Information_Systems
|
[
"student_events",
"students"
] |
Find the biographical data and event date for students who participated in any events.
|
SELECT T1.bio_data , T2.event_date FROM Students AS T1 JOIN Student_Events AS T2 ON T1.student_id = T2.student_id
|
medium
|
467 |
cre_Students_Information_Systems
|
[
"ref_event_types",
"student_events",
"students"
] |
How many students have joined in the most common type of event? List the number, the event type and description.
|
SELECT count(*) , T2.event_type_code , T3.event_type_description FROM Students AS T1 JOIN Student_Events AS T2 ON T1.student_id = T2.student_id JOIN Ref_Event_Types AS T3 ON T2.event_type_code = T3.event_type_code GROUP BY T2.event_type_code ORDER BY count(*) DESC LIMIT 1
|
extra
|
468 |
cre_Students_Information_Systems
|
[
"ref_event_types",
"student_events",
"students"
] |
What is the type of event the most students joined? Give me the number of students, and the event type code and description.
|
SELECT count(*) , T2.event_type_code , T3.event_type_description FROM Students AS T1 JOIN Student_Events AS T2 ON T1.student_id = T2.student_id JOIN Ref_Event_Types AS T3 ON T2.event_type_code = T3.event_type_code GROUP BY T2.event_type_code ORDER BY count(*) DESC LIMIT 1
|
extra
|
469 |
cre_Students_Information_Systems
|
[
"ref_achievement_type",
"achievements"
] |
How are all the achievements described? List the achievement detail and the type description.
|
SELECT T1.achievement_details , T2.achievement_type_description FROM Achievements AS T1 JOIN Ref_Achievement_Type AS T2 ON T1.achievement_type_code = T2.achievement_type_code
|
medium
|
470 |
cre_Students_Information_Systems
|
[
"ref_achievement_type",
"achievements"
] |
What are the achievement detail and the type description of each achievements?
|
SELECT T1.achievement_details , T2.achievement_type_description FROM Achievements AS T1 JOIN Ref_Achievement_Type AS T2 ON T1.achievement_type_code = T2.achievement_type_code
|
medium
|
471 |
cre_Students_Information_Systems
|
[
"achievements",
"teachers",
"classes"
] |
How many teachers have taught a student who has not won any achievements?
|
SELECT count(DISTINCT T1.teacher_id) FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.student_id NOT IN ( SELECT student_id FROM Achievements )
|
extra
|
472 |
cre_Students_Information_Systems
|
[
"achievements",
"teachers",
"classes"
] |
Count the number of teachers who have taught students who have never won an achievement.
|
SELECT count(DISTINCT T1.teacher_id) FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.student_id NOT IN ( SELECT student_id FROM Achievements )
|
extra
|
473 |
cre_Students_Information_Systems
|
[
"transcripts"
] |
List the date of the transcripts and the transcript details.
|
SELECT date_of_transcript , transcript_details FROM Transcripts
|
medium
|
474 |
cre_Students_Information_Systems
|
[
"transcripts"
] |
What are the date and detail of each transcript?
|
SELECT date_of_transcript , transcript_details FROM Transcripts
|
medium
|
475 |
cre_Students_Information_Systems
|
[
"achievements"
] |
List the achievement type code, achievement details and the date of the achievements.
|
SELECT achievement_type_code , achievement_details , date_achievement FROM Achievements
|
medium
|
476 |
cre_Students_Information_Systems
|
[
"achievements"
] |
What are the type code, details, and date of each achievement?
|
SELECT achievement_type_code , achievement_details , date_achievement FROM Achievements
|
medium
|
477 |
cre_Students_Information_Systems
|
[
"detention"
] |
Show the detention start time and end time of the detentions.
|
SELECT datetime_detention_start , datetime_detention_end FROM Detention
|
medium
|
478 |
cre_Students_Information_Systems
|
[
"detention"
] |
What are the starting time and ending time of each detention record?
|
SELECT datetime_detention_start , datetime_detention_end FROM Detention
|
medium
|
479 |
cre_Students_Information_Systems
|
[
"students"
] |
Show the biographical information of the students whose details include the substring 'Suite'.
|
SELECT bio_data FROM Students WHERE student_details LIKE '%Suite%'
|
medium
|
480 |
cre_Students_Information_Systems
|
[
"students"
] |
Which students have 'Suite' as a substring in their details? Give me their biographical information.
|
SELECT bio_data FROM Students WHERE student_details LIKE '%Suite%'
|
medium
|
481 |
cre_Students_Information_Systems
|
[
"teachers",
"classes",
"students"
] |
List the details for all the pairs of teachers and students who are in the same class.
|
SELECT T1.teacher_details , T3.student_details FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id JOIN Students AS T3 ON T2.student_id = T3.student_id
|
medium
|
482 |
cre_Students_Information_Systems
|
[
"teachers",
"classes",
"students"
] |
What are the pairs of teachers and students who are in the same class? Give me the pairs of their details.
|
SELECT T1.teacher_details , T3.student_details FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id JOIN Students AS T3 ON T2.student_id = T3.student_id
|
medium
|
483 |
cre_Students_Information_Systems
|
[
"classes"
] |
How many courses do teachers teach at most? Also find the id of the teacher who teaches the most.
|
SELECT count(*) , teacher_id FROM Classes GROUP BY teacher_id ORDER BY count(*) DESC LIMIT 1
|
hard
|
484 |
cre_Students_Information_Systems
|
[
"classes"
] |
Which teacher teaches the most courses? Give me the id of the teacher and the number of courses he or she teaches.
|
SELECT count(*) , teacher_id FROM Classes GROUP BY teacher_id ORDER BY count(*) DESC LIMIT 1
|
hard
|
485 |
cre_Students_Information_Systems
|
[
"classes"
] |
How many courses do students take at most? Also find the id of the student who takes the most courses.
|
SELECT count(*) , student_id FROM Classes GROUP BY student_id ORDER BY count(*) DESC LIMIT 1
|
hard
|
486 |
cre_Students_Information_Systems
|
[
"classes"
] |
Which student is taking the most courses? Give me the id of the student and the number of courses he or she is taking.
|
SELECT count(*) , student_id FROM Classes GROUP BY student_id ORDER BY count(*) DESC LIMIT 1
|
hard
|
487 |
cre_Students_Information_Systems
|
[
"classes",
"students"
] |
Which students take 2 courses? List student id and details.
|
SELECT T1.student_id , T1.student_details FROM Students AS T1 JOIN Classes AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING count(*) = 2
|
medium
|
488 |
cre_Students_Information_Systems
|
[
"classes",
"students"
] |
What are the ids and details of the students who take 2 courses?
|
SELECT T1.student_id , T1.student_details FROM Students AS T1 JOIN Classes AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING count(*) = 2
|
medium
|
489 |
cre_Students_Information_Systems
|
[
"ref_detention_type",
"detention"
] |
What is the least common detention type? Show the type code and the description.
|
SELECT T1.detention_type_code , T2.detention_type_description FROM Detention AS T1 JOIN Ref_Detention_Type AS T2 ON T1.detention_type_code = T2.detention_type_code GROUP BY T1.detention_type_code ORDER BY count(*) ASC LIMIT 1
|
extra
|
490 |
cre_Students_Information_Systems
|
[
"ref_detention_type",
"detention"
] |
Give me the type code and description of the least common detention type.
|
SELECT T1.detention_type_code , T2.detention_type_description FROM Detention AS T1 JOIN Ref_Detention_Type AS T2 ON T1.detention_type_code = T2.detention_type_code GROUP BY T1.detention_type_code ORDER BY count(*) ASC LIMIT 1
|
extra
|
491 |
cre_Students_Information_Systems
|
[
"student_loans",
"students"
] |
Which students have a student loan more than the average amount? List the students' biographical data and the details.
|
SELECT T1.bio_data , T1.student_details FROM Students AS T1 JOIN Student_Loans AS T2 ON T1.student_id = T2.student_id WHERE T2.amount_of_loan > ( SELECT avg(amount_of_loan) FROM Student_Loans )
|
extra
|
492 |
cre_Students_Information_Systems
|
[
"student_loans",
"students"
] |
Find the biographical data and details for students whose student loan is above the average amount.
|
SELECT T1.bio_data , T1.student_details FROM Students AS T1 JOIN Student_Loans AS T2 ON T1.student_id = T2.student_id WHERE T2.amount_of_loan > ( SELECT avg(amount_of_loan) FROM Student_Loans )
|
extra
|
493 |
cre_Students_Information_Systems
|
[
"student_loans"
] |
When was the earliest date of loan?
|
SELECT date_of_loan FROM Student_Loans ORDER BY date_of_loan ASC LIMIT 1
|
medium
|
494 |
cre_Students_Information_Systems
|
[
"student_loans"
] |
Return the earliest date of loan in the record.
|
SELECT date_of_loan FROM Student_Loans ORDER BY date_of_loan ASC LIMIT 1
|
medium
|
495 |
cre_Students_Information_Systems
|
[
"student_loans",
"students"
] |
Which student has the loan with the minimum value? List the student's biographical information.
|
SELECT T1.bio_data FROM Students AS T1 JOIN Student_Loans AS T2 ON T1.student_id = T2.student_id ORDER BY T2.amount_of_loan ASC LIMIT 1
|
hard
|
496 |
cre_Students_Information_Systems
|
[
"student_loans",
"students"
] |
Find the biographical information of the student with the smallest student loan.
|
SELECT T1.bio_data FROM Students AS T1 JOIN Student_Loans AS T2 ON T1.student_id = T2.student_id ORDER BY T2.amount_of_loan ASC LIMIT 1
|
hard
|
497 |
cre_Students_Information_Systems
|
[
"transcripts",
"student_loans"
] |
When was the transcript issued for the student with loan of maximum value?
|
SELECT T1.date_of_transcript FROM Transcripts AS T1 JOIN Student_Loans AS T2 ON T1.student_id = T2.student_id ORDER BY T2.amount_of_loan DESC LIMIT 1
|
hard
|
498 |
cre_Students_Information_Systems
|
[
"transcripts",
"student_loans"
] |
What is the transcript issuance date for the student with the largest amount of loan?
|
SELECT T1.date_of_transcript FROM Transcripts AS T1 JOIN Student_Loans AS T2 ON T1.student_id = T2.student_id ORDER BY T2.amount_of_loan DESC LIMIT 1
|
hard
|
499 |
cre_Students_Information_Systems
|
[
"transcripts",
"teachers",
"classes"
] |
Which teachers have taught the student with the earliest transcript issuance? List the teacher details.
|
SELECT T1.teacher_details FROM Teachers AS T1 JOIN Classes AS T2 ON T1.teacher_id = T2.teacher_id JOIN Transcripts AS T3 ON T2.student_id = T3.student_id ORDER BY T3.date_of_transcript ASC LIMIT 1
|
extra
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.