minktn/spider-data huggingface dataset:
Database: vehicle_rent
Question: What are the average city fuel economy rate, average highway fuel economy rate for different types of powertrains?
SQL: SELECT avg(City_fuel_economy_rate) ,  avg(Highway_fuel_economy_rate) , Type_of_powertrain FROM vehicles GROUP BY Type_of_powertrain
Database: cre_Students_Information_Systems
Question: What is the average amount of a student loan?
SQL: SELECT avg(amount_of_loan) FROM Student_Loans
Database: cre_Students_Information_Systems
Question: Compute the average amount of student loans.
SQL: SELECT avg(amount_of_loan) FROM Student_Loans
Database: cre_Students_Information_Systems
Question: 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.
SQL: 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
Database: cre_Students_Information_Systems
Question: 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?
SQL: 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
Database: cre_Students_Information_Systems
Question: 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'
SQL: 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%'
Database: cre_Students_Information_Systems
Question: 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.
SQL: 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%'
Database: cre_Students_Information_Systems
Question: List the biographical data of the students who never had a detention or student loan .
SQL: 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)
Database: cre_Students_Information_Systems
Question: Which students never had a detention or student loan ? Find their biographical data .
SQL: 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)
Database: cre_Students_Information_Systems
Question: What are the loan amounts and loan dates of the students who have at least 2 achievements?
SQL: 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 )
Database: cre_Students_Information_Systems
Question: List the amount and date of loan for the students who have two or more achievements.
SQL: 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 )
Database: cre_Students_Information_Systems
Question: List the detail and id of the teacher who teaches the most courses.
SQL: 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
Database: cre_Students_Information_Systems
Question: What are the detail and id of the teacher who teaches the largest number of courses?
SQL: 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
Database: cre_Students_Information_Systems
Question: What are the distinct descriptions of all the detentions which have ever happened?
SQL: 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
Database: cre_Students_Information_Systems
Question: Return the distinct descriptions of all the detentions that have happened.
SQL: 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
Database: cre_Students_Information_Systems
Question: List the personal details and the address type descriptions of all the students.
SQL: 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
Database: cre_Students_Information_Systems
Question: What are the personal details and the address type descriptions of each student?
SQL: 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
Database: cre_Students_Information_Systems
Question: List the the address details and the biographical information of the students.
SQL: 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
Database: cre_Students_Information_Systems
Question: What are the address details and biographical information of each student?
SQL: 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
Database: cre_Students_Information_Systems
Question: List the biographical data and the date of the transcript of all the students.
SQL: SELECT T1.bio_data ,  T2.date_of_transcript FROM Students AS T1 JOIN Transcripts AS T2 ON T1.student_id  =  T2.student_id
Database: cre_Students_Information_Systems
Question: What are the biographical data and the date of transcript issuance of each student?
SQL: SELECT T1.bio_data ,  T2.date_of_transcript FROM Students AS T1 JOIN Transcripts AS T2 ON T1.student_id  =  T2.student_id
Database: cre_Students_Information_Systems
Question: How many students got the most common result in the behavioral monitoring details? Also list the result details.
SQL: SELECT count(DISTINCT student_id) ,  behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details ORDER BY count(*) DESC LIMIT 1
Database: cre_Students_Information_Systems
Question: Find the most common result in the behavioral monitoring details. What are the count and the details of this result?
SQL: SELECT count(DISTINCT student_id) ,  behaviour_monitoring_details FROM Behaviour_Monitoring GROUP BY behaviour_monitoring_details ORDER BY count(*) DESC LIMIT 1
Database: cre_Students_Information_Systems
Question: 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.
SQL: 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 )
Database: cre_Students_Information_Systems
Question: 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.
SQL: 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 )
Database: cre_Students_Information_Systems
Question: Which students only got the most common result for his or her all behaviour monitoring details? List the students' biographical information.
SQL: 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 )
Database: cre_Students_Information_Systems
Question: What is the biographical information of the students who got the most common result for their behaviour monitoring details ?
SQL: 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 )
Database: cre_Students_Information_Systems
Question: Which students have gone through any event? List the students' biographical data and event date.
SQL: SELECT T1.bio_data ,  T2.event_date FROM Students AS T1 JOIN Student_Events AS T2 ON T1.student_id  =  T2.student_id
Database: cre_Students_Information_Systems
Question: Find the biographical data and event date for students who participated in any events.
SQL: SELECT T1.bio_data ,  T2.event_date FROM Students AS T1 JOIN Student_Events AS T2 ON T1.student_id  =  T2.student_id
Database: cre_Students_Information_Systems
Question: How many students have joined in the most common type of event? List the number, the event type and description.
SQL: 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
Database: cre_Students_Information_Systems
Question: What is the type of event the most students joined? Give me the number of students, and the event type code and description.
SQL: 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
Database: cre_Students_Information_Systems
Question: How are all the achievements described? List the achievement detail and the type description.
SQL: 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
Database: cre_Students_Information_Systems
Question: What are the achievement detail and the type description of each achievements?
SQL: 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
Database: cre_Students_Information_Systems
Question: How many teachers have taught a student who has not won any achievements?
SQL: 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 )
Database: cre_Students_Information_Systems
Question: Count the number of teachers who have taught students who have never won an achievement.
SQL: 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 )
Database: cre_Students_Information_Systems
Question: List the date of the transcripts and the transcript details.
SQL: SELECT date_of_transcript ,  transcript_details FROM Transcripts
Database: cre_Students_Information_Systems
Question: What are the date and detail of each transcript?
SQL: SELECT date_of_transcript ,  transcript_details FROM Transcripts
Database: cre_Students_Information_Systems
Question: List the achievement type code, achievement details and the date of the achievements.
SQL: SELECT achievement_type_code ,  achievement_details ,  date_achievement FROM Achievements
Database: cre_Students_Information_Systems
Question: What are the type code, details, and date of each achievement?
SQL: SELECT achievement_type_code ,  achievement_details ,  date_achievement FROM Achievements
Database: cre_Students_Information_Systems
Question: Show the detention start time and end time of the detentions.
SQL: SELECT datetime_detention_start ,  datetime_detention_end FROM Detention
Database: cre_Students_Information_Systems
Question: What are the starting time and ending time of each detention record?
SQL: SELECT datetime_detention_start ,  datetime_detention_end FROM Detention
Database: cre_Students_Information_Systems
Question: Show the biographical information of the students whose details include the substring 'Suite'.
SQL: SELECT bio_data FROM Students WHERE student_details LIKE '%Suite%'
Database: cre_Students_Information_Systems
Question: Which students have 'Suite' as a substring in their details? Give me their biographical information.
SQL: SELECT bio_data FROM Students WHERE student_details LIKE '%Suite%'
Database: cre_Students_Information_Systems
Question: List the details for all the pairs of teachers and students who are in the same class.
SQL: 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
Database: cre_Students_Information_Systems
Question: What are the pairs of teachers and students who are in the same class? Give me the pairs of their details.
SQL: 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
Database: cre_Students_Information_Systems
Question: How many courses do teachers teach at most? Also find the id of the teacher who teaches the most.
SQL: SELECT count(*) ,  teacher_id FROM Classes GROUP BY teacher_id ORDER BY count(*) DESC LIMIT 1
Database: cre_Students_Information_Systems
Question: Which teacher teaches the most courses? Give me the id of the teacher and the number of courses he or she teaches.
SQL: SELECT count(*) ,  teacher_id FROM Classes GROUP BY teacher_id ORDER BY count(*) DESC LIMIT 1
Database: cre_Students_Information_Systems
Question: How many courses do students take at most? Also find the id of the student who takes the most courses.
SQL: SELECT count(*) ,  student_id FROM Classes GROUP BY student_id ORDER BY count(*) DESC LIMIT 1
Database: cre_Students_Information_Systems
Question: Which student is taking the most courses? Give me the id of the student and the number of courses he or she is taking.
SQL: SELECT count(*) ,  student_id FROM Classes GROUP BY student_id ORDER BY count(*) DESC LIMIT 1
Database: cre_Students_Information_Systems
Question: Which students take 2 courses? List student id and details.
SQL: 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
Database: cre_Students_Information_Systems
Question: What are the ids and details of the students who take 2 courses?
SQL: 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
Database: cre_Students_Information_Systems
Question: What is the least common detention type? Show the type code and the description.
SQL: 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
Database: cre_Students_Information_Systems
Question: Give me the type code and description of the least common detention type.
SQL: 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
Database: cre_Students_Information_Systems
Question: Which students have a student loan more than the average amount? List the students' biographical data and the details.
SQL: 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 )
Database: cre_Students_Information_Systems
Question: Find the biographical data and details for students whose student loan is above the average amount.
SQL: 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 )
Database: cre_Students_Information_Systems
Question: When was the earliest date of loan?
SQL: SELECT date_of_loan FROM Student_Loans ORDER BY date_of_loan ASC LIMIT 1
Database: cre_Students_Information_Systems
Question: Return the earliest date of loan in the record.
SQL: SELECT date_of_loan FROM Student_Loans ORDER BY date_of_loan ASC LIMIT 1
Database: cre_Students_Information_Systems
Question: Which student has the loan with the minimum value? List the student's biographical information.
SQL: 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
Database: cre_Students_Information_Systems
Question: Find the biographical information of the student with the smallest student loan.
SQL: 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
Database: cre_Students_Information_Systems
Question: When was the transcript issued for the student with loan of maximum value?
SQL: 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
Database: cre_Students_Information_Systems
Question: What is the transcript issuance date for the student with the largest amount of loan?
SQL: 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
Database: cre_Students_Information_Systems
Question: Which teachers have taught the student with the earliest transcript issuance? List the teacher details.
SQL: 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
Database: cre_Students_Information_Systems
Question: Find the details of the teachers who have taught the student with the earliest transcript issuance.
SQL: 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
Database: cre_Students_Information_Systems
Question: How much total loan does each student have ? List the student ids and the amounts .
SQL: select student_id ,  sum(amount_of_loan) from student_loans group by student_id
Database: cre_Students_Information_Systems
Question: For each student, find the student id and the total amount of loan he or she has.
SQL: SELECT student_id ,  sum(amount_of_loan) FROM Student_Loans GROUP BY student_id
Database: cre_Students_Information_Systems
Question: How many courses does each student take? List the student id, the student biographical data and the course count.
SQL: SELECT T1.student_id ,  T1.bio_data ,  count(*) FROM Students AS T1 JOIN Classes AS T2 ON T1.student_id  =  T2.student_id GROUP BY T1.student_id
Database: cre_Students_Information_Systems
Question: For each student, find the student id, student biographical data, and the number of courses he or she takes.
SQL: SELECT T1.student_id ,  T1.bio_data ,  count(*) FROM Students AS T1 JOIN Classes AS T2 ON T1.student_id  =  T2.student_id GROUP BY T1.student_id
Database: cre_Students_Information_Systems
Question: How many students have gone through a detention?
SQL: SELECT count(DISTINCT student_id) FROM Detention
Database: cre_Students_Information_Systems
Question: Count the number of students who have a detention record.
SQL: SELECT count(DISTINCT student_id) FROM Detention
Database: cre_Students_Information_Systems
Question: What is the code and description of the most common student address type?
SQL: SELECT T1.address_type_code ,  T2.address_type_description FROM Students_Addresses AS T1 JOIN Ref_Address_Types AS T2 WHERE T1.address_type_code  =  T2.address_type_code GROUP BY T1.address_type_code ORDER BY count(*) DESC LIMIT 1
Database: cre_Students_Information_Systems
Question: What is the most common student address type? Give me the code and description of the address type.
SQL: SELECT T1.address_type_code ,  T2.address_type_description FROM Students_Addresses AS T1 JOIN Ref_Address_Types AS T2 WHERE T1.address_type_code  =  T2.address_type_code GROUP BY T1.address_type_code ORDER BY count(*) DESC LIMIT 1
Database: cre_Students_Information_Systems
Question: For those students who have gone through an event, who do not have a student loan? List the students' biographical data
SQL: SELECT T1.bio_data FROM Students AS T1 JOIN Student_Events AS T2 WHERE T1.student_id  =  T2.student_id EXCEPT SELECT T1.bio_data FROM Students AS T1 JOIN Student_Loans AS T2 WHERE T1.student_id  =  T2.student_id
Database: cre_Students_Information_Systems
Question: Among the students who have an event record, who do not have a student loan? Return the students' biographical data.
SQL: SELECT T1.bio_data FROM Students AS T1 JOIN Student_Events AS T2 WHERE T1.student_id  =  T2.student_id EXCEPT SELECT T1.bio_data FROM Students AS T1 JOIN Student_Loans AS T2 WHERE T1.student_id  =  T2.student_id
Database: cre_Students_Information_Systems
Question: List the start time and the end time of the students' addresses for the students who have 2 transcripts.
SQL: SELECT date_from ,  date_to FROM Students_Addresses WHERE student_id IN ( SELECT student_id FROM Transcripts GROUP BY student_id HAVING count(*)  =  2 )
Database: cre_Students_Information_Systems
Question: What are the start time and end time of addresses for the students who receive 2 transcripts?
SQL: SELECT date_from ,  date_to FROM Students_Addresses WHERE student_id IN ( SELECT student_id FROM Transcripts GROUP BY student_id HAVING count(*)  =  2 )
Database: cre_Students_Information_Systems
Question: When did all the detentions start?
SQL: SELECT datetime_detention_start FROM Detention
Database: cre_Students_Information_Systems
Question: Give me the detention start date for all the detention records.
SQL: SELECT datetime_detention_start FROM Detention
Database: book_1
Question: List all the author names.
SQL: SELECT name FROM Author
Database: book_1
Question: What are the names of all the authors?
SQL: SELECT name FROM Author
Database: book_1
Question: Show all Client names and their addresses.
SQL: SELECT name ,  address FROM Client
Database: book_1
Question: What are the names and addressed of all clients?
SQL: SELECT name ,  address FROM Client
Database: book_1
Question: List all Book titles, ISBNs, and sale prices.
SQL: SELECT title ,  isbn ,  SalePrice FROM Book
Database: book_1
Question: What are the titles, ISBNs, and sale prices for all books?
SQL: SELECT title ,  isbn ,  SalePrice FROM Book
Database: book_1
Question: How many books do we have?
SQL: SELECT count(*) FROM Book
Database: book_1
Question: Count the number of books.
SQL: SELECT count(*) FROM Book
Database: book_1
Question: How many authors are there?
SQL: SELECT count(*) FROM Author
Database: book_1
Question: Count the number of authors.
SQL: SELECT count(*) FROM Author
Database: book_1
Question: How many clients are there?
SQL: SELECT count(*) FROM Client
Database: book_1
Question: Return the number of clients.
SQL: SELECT count(*) FROM Client
Database: book_1
Question: List names and addresses of all clients in alphabetical order by their names.
SQL: SELECT name ,  address FROM Client ORDER BY name
Database: book_1
Question: What are the names and addressed of all clients, ordered alphabetically by name?
SQL: SELECT name ,  address FROM Client ORDER BY name
Database: book_1
Question: Show all book titles and corresponding author names.
SQL: SELECT T3.title ,  T1.name FROM Author AS T1 JOIN Author_Book AS T2 ON T2.Author  =  T1.idAuthor JOIN Book AS T3 ON T2.isbn  =  T3.isbn
Database: book_1
Question: What are the names of all books and their corresponding authors?
SQL: SELECT T3.title ,  T1.name FROM Author AS T1 JOIN Author_Book AS T2 ON T2.Author  =  T1.idAuthor JOIN Book AS T3 ON T2.isbn  =  T3.isbn
Database: book_1
Question: Show all order ids and their client names.
SQL: SELECT T1.idOrder ,  T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient
Database: book_1
Question: What are the ids of all orders and the corresponding client names?
SQL: SELECT T1.idOrder ,  T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient
Database: book_1
Question: Show all author names and the numbers of books each has written.
SQL: SELECT T1.name ,  count(*) FROM Author AS T1 JOIN Author_Book AS T2 ON T1.idAuthor  =  T2.Author GROUP BY T1.idAuthor
Database: book_1
Question: What are the names of all the authors, and how many books has each written?
SQL: SELECT T1.name ,  count(*) FROM Author AS T1 JOIN Author_Book AS T2 ON T1.idAuthor  =  T2.Author GROUP BY T1.idAuthor
Database: book_1
Question: Show all book isbns and the numbers of orders for each.
SQL: SELECT isbn ,  count(*) FROM Books_Order GROUP BY isbn
Database: book_1
Question: What are all isbns for each book, and how many times has each been ordered?
SQL: SELECT isbn ,  count(*) FROM Books_Order GROUP BY isbn
Database: book_1
Question: Show all book isbns and the total amount ordered for each.
SQL: SELECT isbn ,  sum(amount) FROM Books_Order GROUP BY isbn
Database: book_1
Question: What are the isbns for all books, and what is the total amount ordered for each?
SQL: SELECT isbn ,  sum(amount) FROM Books_Order GROUP BY isbn
Database: book_1
Question: Show the book title corresponding to the book with the most number of orders.
SQL: SELECT T2.title FROM Books_Order AS T1 JOIN Book AS T2 ON T1.isbn  =  T2.isbn GROUP BY T1.isbn ORDER BY count(*) DESC LIMIT 1
Database: book_1
Question: What is the title of the book that has been ordered the greatest number of times?
SQL: SELECT T2.title FROM Books_Order AS T1 JOIN Book AS T2 ON T1.isbn  =  T2.isbn GROUP BY T1.isbn ORDER BY count(*) DESC LIMIT 1
Database: book_1
Question: Show the book title and purchase price of the book that has had the greatest amount in orders.
SQL: SELECT T2.title ,  T2.PurchasePrice FROM Books_Order AS T1 JOIN BOOk AS T2 ON T1.isbn  =  T2.isbn GROUP BY T1.isbn ORDER BY sum(amount) DESC LIMIT 1
Database: book_1
Question: What is the title and purchase price of the book that has the highest total order amount?
SQL: SELECT T2.title ,  T2.PurchasePrice FROM Books_Order AS T1 JOIN BOOk AS T2 ON T1.isbn  =  T2.isbn GROUP BY T1.isbn ORDER BY sum(amount) DESC LIMIT 1
Database: book_1
Question: Show the titles of books that have been ordered.
SQL: SELECT DISTINCT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn  =  T2.isbn
Database: book_1
Question: What are the different titles of books that have been ordered in the past?
SQL: SELECT DISTINCT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn  =  T2.isbn
Database: book_1
Question: Show the names of clients who have ordered at least once.
SQL: SELECT DISTINCT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient  =  T2.idClient
Database: book_1
Question: What are the names of the different clients who have made an order?
SQL: SELECT DISTINCT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient  =  T2.idClient
Database: book_1
Question: Show all client names and the number of orders each has made.
SQL: SELECT T2.name ,  count(*) FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient GROUP BY T1.idClient
Database: book_1
Question: What are the names of all the clients, and how many times has each of them ordered?
SQL: SELECT T2.name ,  count(*) FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient GROUP BY T1.idClient
Database: book_1
Question: What is the name of the client with the most number of orders?
SQL: SELECT T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient GROUP BY T1.idClient ORDER BY count(*) DESC LIMIT 1
Database: book_1
Question: Give the name of the client who has made the most orders.
SQL: SELECT T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient GROUP BY T1.idClient ORDER BY count(*) DESC LIMIT 1
Database: book_1
Question: Show the client names and their total amounts of books ordered.
SQL: SELECT T2.name ,  sum(T3.amount) FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient JOIN Books_Order AS T3 ON T3.idOrder  =  T1.idOrder GROUP BY T1.idClient
Database: book_1
Question: What are the names of all the clients, and the total amount of books ordered by each?
SQL: SELECT T2.name ,  sum(T3.amount) FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient JOIN Books_Order AS T3 ON T3.idOrder  =  T1.idOrder GROUP BY T1.idClient
Database: book_1
Question: Show the client name who has the most total amount of books ordered.
SQL: SELECT T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient JOIN Books_Order AS T3 ON T3.idOrder  =  T1.idOrder GROUP BY T1.idClient ORDER BY sum(T3.amount) DESC LIMIT 1
Database: book_1
Question: What is the name of the client who has ordered the greatest total amount of books?
SQL: SELECT T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient  =  T2.idClient JOIN Books_Order AS T3 ON T3.idOrder  =  T1.idOrder GROUP BY T1.idClient ORDER BY sum(T3.amount) DESC LIMIT 1
Database: book_1
Question: Show all book titles for books that have no orders.
SQL: SELECT title FROM book EXCEPT SELECT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn  =  T2.isbn
Database: book_1
Question: What are the titles of books that have never been ordered?
SQL: SELECT title FROM book EXCEPT SELECT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn  =  T2.isbn
Database: book_1
Question: Show all client names for clients who have not made orders.
SQL: SELECT name FROM Client EXCEPT SELECT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient  =  T2.idClient
Database: book_1
Question: What are the names of clients who have never made an order?
SQL: SELECT name FROM Client EXCEPT SELECT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient  =  T2.idClient
Database: book_1
Question: What is the maximum and the minimum sale price?
SQL: SELECT max(saleprice) ,  min(saleprice) FROM Book
Database: book_1
Question: Give the maximum and minimum sale price of books.
SQL: SELECT max(saleprice) ,  min(saleprice) FROM Book
Database: book_1
Question: What is the average purchase price and the average sale price?
SQL: SELECT avg(purchaseprice) ,  avg(saleprice) FROM Book
Database: book_1
Question: Give the average purchase price and average sale price for books.
SQL: SELECT avg(purchaseprice) ,  avg(saleprice) FROM Book
Database: book_1
Question: What is the maximum difference between the sale price and purchase price?
SQL: SELECT max(saleprice - purchaseprice) FROM Book
Database: book_1
Question: Return the largest difference in sale price and purchase price.
SQL: SELECT max(saleprice - purchaseprice) FROM Book
Database: book_1
Question: List all book titles which have sale prices higher than the average.
SQL: SELECT title FROM book WHERE saleprice  >  (SELECT avg(saleprice) FROM book)
Database: book_1
Question: What are the titles of books with sale prices above the average sale price across all books?
SQL: SELECT title FROM book WHERE saleprice  >  (SELECT avg(saleprice) FROM book)
Database: book_1
Question: List all book titles which have the lowest sale price .
SQL: select title from book order by saleprice asc limit 1
Database: book_1
Question: What are the titles of books that have a sale price equal to the lowest sale price across all books ?
SQL: select title from book order by saleprice asc limit 1
Database: book_1
Question: List all book titles which have highest purchase prices .
SQL: select title from book order by purchaseprice  desc limit 1
Database: book_1
Question: What are the titles of books with the highest purchase price across all books ?
SQL: select title from book order by purchaseprice  desc limit 1
Database: book_1
Question: What is the average sale price of books written by George Orwell?
SQL: SELECT avg(saleprice) FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name  =  "George Orwell"
Database: book_1
Question: Give the average sale price of books authored by George Orwell.
SQL: SELECT avg(saleprice) FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name  =  "George Orwell"
Database: book_1
Question: What are sale prices of books written by Plato?
SQL: SELECT saleprice FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name  =  "Plato"
Database: book_1
Question: Return the sale prices of books authored by Plato.
SQL: SELECT saleprice FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name  =  "Plato"
Database: book_1
Question: What is the title of the book written by George Orwell that has the lowest sale price?
SQL: SELECT T1.title FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name  =  "George Orwell" ORDER BY T1.saleprice LIMIT 1
Database: book_1
Question: Give the title of book by George Orwell that has the lowest saleprice.
SQL: SELECT T1.title FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name  =  "George Orwell" ORDER BY T1.saleprice LIMIT 1
Database: book_1
Question: What is the title of the book written by Plato has price lower than the average sale price of all books?
SQL: SELECT T1.title FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name  =  "Plato" AND T1.saleprice  <  (SELECT avg(saleprice) FROM Book)
Database: book_1
Question: Give the titles of books authored by Plato that have a sale price lower than the average sale price across all books.
SQL: SELECT T1.title FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name  =  "Plato" AND T1.saleprice  <  (SELECT avg(saleprice) FROM Book)
Database: book_1
Question: Who is the author of the book "Pride and Prejudice"?
SQL: SELECT T3.name FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T1.title  =  "Pride and Prejudice"
Database: book_1
Question: Give the name of the author who wrote the book titled Pride and Prejudice.
SQL: SELECT T3.name FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T1.title  =  "Pride and Prejudice"
Database: book_1
Question: List titles of all books published by an author whose name contains the string 'Plato'?
SQL: SELECT T1.title FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name LIKE "%Plato%"
Database: book_1
Question: What are the titles of all books written by an author with a name that contains Plato?
SQL: SELECT T1.title FROM Book AS T1 JOIN Author_book AS T2 ON T1.isbn  =  T2.isbn JOIN Author AS T3 ON T2.Author  =  T3.idAuthor WHERE T3.name LIKE "%Plato%"
Database: book_1
Question: How many orders do we have for "Pride and Prejudice"?
SQL: SELECT count(*) FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn  =  T2.isbn WHERE T1.title  =  "Pride and Prejudice"
Database: book_1
Question: Return the number of orders received for Pride and Prejudice.
SQL: SELECT count(*) FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn  =  T2.isbn WHERE T1.title  =  "Pride and Prejudice"
Database: book_1
Question: Show ids for orders including both "Pride and Prejudice" and "The Little Prince".
SQL: SELECT idOrder FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn  =  T2.isbn WHERE T1.title  =  "Pride and Prejudice" INTERSECT SELECT idOrder FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn  =  T2.isbn WHERE T1.title  =  "The Little Prince"
Database: book_1
Question: What are the order ids for orders that include both Pride and Prejudice and The Little Prince?
SQL: SELECT idOrder FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn  =  T2.isbn WHERE T1.title  =  "Pride and Prejudice" INTERSECT SELECT idOrder FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn  =  T2.isbn WHERE T1.title  =  "The Little Prince"
Database: book_1
Question: Show all book isbns which were ordered by both client Peter Doe and client James Smith.
SQL: SELECT T2.isbn FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient WHERE T3.name  =  "Peter Doe" INTERSECT SELECT T2.isbn FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient WHERE T3.name  =  "James Smith"
Database: book_1
Question: What are the isbns of books ordered by both clients named Peter Doe and James Smith?
SQL: SELECT T2.isbn FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient WHERE T3.name  =  "Peter Doe" INTERSECT SELECT T2.isbn FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient WHERE T3.name  =  "James Smith"
Database: book_1
Question: Find the title of books which are ordered by client Peter Doe but not client James Smith.
SQL: SELECT T4.title FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient JOIN book AS T4 ON T2.ISBN  =  T4.isbn WHERE T3.name  =  "Peter Doe" EXCEPT SELECT T4.title FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient JOIN book AS T4 ON T2.ISBN  =  T4.isbn WHERE T3.name  =  "James Smith"
Database: book_1
Question: What are the titles of books that the client Peter Doe ordered, but the client James Smith did not?
SQL: SELECT T4.title FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient JOIN book AS T4 ON T2.ISBN  =  T4.isbn WHERE T3.name  =  "Peter Doe" EXCEPT SELECT T4.title FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient JOIN book AS T4 ON T2.ISBN  =  T4.isbn WHERE T3.name  =  "James Smith"
Database: book_1
Question: Show all client names who have orders for "Pride and Prejudice".
SQL: SELECT T3.name FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient JOIN Book AS T4 ON T4.isbn  =  T2.isbn WHERE T4.title  =  "Pride and Prejudice"
Database: book_1
Question: What are the names of clients who have ordered Pride and Prejudice?
SQL: SELECT T3.name FROM Orders AS T1 JOIN Books_Order AS T2 ON T1.idOrder  =  T2.idOrder JOIN Client AS T3 ON T1.idClient  =  T3.idClient JOIN Book AS T4 ON T4.isbn  =  T2.isbn WHERE T4.title  =  "Pride and Prejudice"
Database: book_review
Question: How many books are there?
SQL: SELECT count(*) FROM book
Database: book_review
Question: List the titles of books in ascending alphabetical order.
SQL: SELECT Title FROM book ORDER BY Title ASC
Database: book_review
Question: List the titles of books in descending order of pages.
SQL: SELECT Title FROM book ORDER BY Pages DESC
Database: book_review
Question: What are the types and release dates of books?
SQL: SELECT TYPE ,  Release FROM book
Database: book_review
Question: What are the maximum and minimum number of chapters for each book?
SQL: SELECT max(Chapters) ,  min(Chapters) FROM book
Database: book_review
Question: What are the titles of books that are not "Poet"?
SQL: SELECT Title FROM book WHERE TYPE != "Poet"
Database: book_review
Question: What is the average rating in reviews?
SQL: SELECT avg(Rating) FROM review
Database: book_review
Question: What are the titles and ratings of books?
SQL: SELECT T1.Title ,  T2.Rating FROM book AS T1 JOIN review AS T2 ON T1.Book_ID  =  T2.Book_ID
Database: book_review
Question: What is the rating of the book with the largest number of chapters?
SQL: SELECT T2.Rating FROM book AS T1 JOIN review AS T2 ON T1.Book_ID  =  T2.Book_ID ORDER BY T1.Chapters DESC LIMIT 1
Database: book_review
Question: What is the rank of the book with the smallest number of pages?
SQL: SELECT T2.Rank FROM book AS T1 JOIN review AS T2 ON T1.Book_ID  =  T2.Book_ID ORDER BY T1.Pages ASC LIMIT 1
Database: book_review
Question: What is the title of the book with the highest rank in the review?
SQL: SELECT T1.Title FROM book AS T1 JOIN review AS T2 ON T1.Book_ID  =  T2.Book_ID ORDER BY T2.Rank LIMIT 1
Database: book_review
Question: What is the average number of readers for books of type "Novel"?
SQL: SELECT avg(T2.Readers_in_Million) FROM book AS T1 JOIN review AS T2 ON T1.Book_ID  =  T2.Book_ID WHERE T1.Type  =  "Novel"
Database: book_review
Question: For each book type return the type and the number of books of that type.
SQL: SELECT TYPE ,  COUNT(*) FROM book GROUP BY TYPE
Database: book_review
Question: What is the most common type of books?
SQL: SELECT TYPE FROM book GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
Database: book_review
Question: What are the types of books that have at least three books belonging to?
SQL: SELECT TYPE FROM book GROUP BY TYPE HAVING COUNT(*)  >=  3
Database: book_review
Question: List the titles of books in ascending order of the ratings in review?
SQL: SELECT T1.Title FROM book AS T1 JOIN review AS T2 ON T1.Book_ID  =  T2.Book_ID ORDER BY T2.Rating ASC
Database: book_review
Question: List the title and audio length for all the books in descending order of the number of readers.
SQL: SELECT T1.Title ,  T1.audio FROM book AS T1 JOIN review AS T2 ON T1.Book_ID  =  T2.Book_ID ORDER BY T2.Readers_in_Million DESC
Database: book_review
Question: How many books do not have reviews?
SQL: SELECT count(*) FROM book WHERE Book_ID NOT IN (SELECT Book_ID FROM review)
Database: book_review
Question: Show the types of books that have both books with more than 75 chapters and books with less than 50 chapters.
SQL: SELECT TYPE FROM book WHERE Chapters  >  75 INTERSECT SELECT TYPE FROM book WHERE Chapters  <  50
Database: book_review
Question: How many distinct types of book are there?
SQL: SELECT count(DISTINCT TYPE) FROM book
Database: book_review
Question: What are the type and title of the books that are not rated?
SQL: SELECT TYPE ,  title FROM book EXCEPT SELECT T1.type ,  T1.title FROM book AS T1 JOIN review AS T2 ON T1.Book_ID  =  T2.Book_ID;
Database: restaurant_bills
Question: How many customers are there?
SQL: SELECT count(*) FROM customer
Database: restaurant_bills
Question: Count the number of customers.
SQL: SELECT count(*) FROM customer
Database: restaurant_bills
Question: List the names of customers in ascending order of level of membership.
SQL: SELECT Name FROM customer ORDER BY Level_of_Membership ASC
Database: restaurant_bills
Question: Sort all the customers by the level of membership in ascending order, and return the customer names.
SQL: SELECT Name FROM customer ORDER BY Level_of_Membership ASC
Database: restaurant_bills
Question: What are the nationalities and card credits of customers?
SQL: SELECT Nationality ,  Card_Credit FROM customer
Database: restaurant_bills
Question: Find the nationality and card credit of each customer.
SQL: SELECT Nationality ,  Card_Credit FROM customer
Database: restaurant_bills
Question: Show the names of customers with nationality "England" or "Australia".
SQL: SELECT Name FROM customer WHERE Nationality  =  "England" OR Nationality  =  "Australia"
Database: restaurant_bills
Question: Which customers have nationality "England" or "Australia"? Give me their names.
SQL: SELECT Name FROM customer WHERE Nationality  =  "England" OR Nationality  =  "Australia"
Database: restaurant_bills
Question: What is the average card credit of customers with membership level higher than 1?
SQL: SELECT avg(Card_Credit) FROM customer WHERE Level_of_Membership  >  1
Database: restaurant_bills
Question: Find the average card credit customers whose membership level is above 1.
SQL: SELECT avg(Card_Credit) FROM customer WHERE Level_of_Membership  >  1
Database: restaurant_bills
Question: What is the card credit of the customer with the highest membership level?
SQL: SELECT Card_Credit FROM customer ORDER BY Level_of_Membership DESC LIMIT 1
Database: restaurant_bills
Question: Find the customer with the highest membership level and return his or her card credit.
SQL: SELECT Card_Credit FROM customer ORDER BY Level_of_Membership DESC LIMIT 1
Database: restaurant_bills
Question: Show different nationalities of customers, along with the number of customers of each nationality.
SQL: SELECT Nationality ,  COUNT(*) FROM customer GROUP BY Nationality
Database: restaurant_bills
Question: How many customers are associated with each nationality? List the nationality and the number of customers.
SQL: SELECT Nationality ,  COUNT(*) FROM customer GROUP BY Nationality
Database: restaurant_bills
Question: Show the most common nationality of customers.
SQL: SELECT Nationality FROM customer GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Database: restaurant_bills
Question: Which nationality does the most customers have?
SQL: SELECT Nationality FROM customer GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Database: restaurant_bills
Question: Show the nations that have both customers with card credit smaller than 50 and customers with card credit bigger than 75.
SQL: SELECT Nationality FROM customer WHERE Card_Credit  <  50 INTERSECT SELECT Nationality FROM customer WHERE Card_Credit  >  75