db_id
stringclasses
40 values
query
stringlengths
22
608
question
stringlengths
22
185
cre_Students_Information_Systems
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
Find the details of the teachers who have taught the student with the earliest transcript issuance.
cre_Students_Information_Systems
select student_id , sum(amount_of_loan) from student_loans group by student_id
How much total loan does each student have ? List the student ids and the amounts .
cre_Students_Information_Systems
SELECT student_id , sum(amount_of_loan) FROM Student_Loans GROUP BY student_id
For each student, find the student id and the total amount of loan he or she has.
cre_Students_Information_Systems
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
How many courses does each student take? List the student id, the student biographical data and the course count.
cre_Students_Information_Systems
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
For each student, find the student id, student biographical data, and the number of courses he or she takes.
cre_Students_Information_Systems
SELECT count(DISTINCT student_id) FROM Detention
How many students have gone through a detention?
cre_Students_Information_Systems
SELECT count(DISTINCT student_id) FROM Detention
Count the number of students who have a detention record.
cre_Students_Information_Systems
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
What is the code and description of the most common student address type?
cre_Students_Information_Systems
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
What is the most common student address type? Give me the code and description of the address type.
cre_Students_Information_Systems
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
For those students who have gone through an event, who do not have a student loan? List the students' biographical data
cre_Students_Information_Systems
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
Among the students who have an event record, who do not have a student loan? Return the students' biographical data.
cre_Students_Information_Systems
SELECT date_from , date_to FROM Students_Addresses WHERE student_id IN ( SELECT student_id FROM Transcripts GROUP BY student_id HAVING count(*) = 2 )
List the start time and the end time of the students' addresses for the students who have 2 transcripts.
cre_Students_Information_Systems
SELECT date_from , date_to FROM Students_Addresses WHERE student_id IN ( SELECT student_id FROM Transcripts GROUP BY student_id HAVING count(*) = 2 )
What are the start time and end time of addresses for the students who receive 2 transcripts?
cre_Students_Information_Systems
SELECT datetime_detention_start FROM Detention
When did all the detentions start?
cre_Students_Information_Systems
SELECT datetime_detention_start FROM Detention
Give me the detention start date for all the detention records.
book_1
SELECT name FROM Author
List all the author names.
book_1
SELECT name FROM Author
What are the names of all the authors?
book_1
SELECT name , address FROM Client
Show all Client names and their addresses.
book_1
SELECT name , address FROM Client
What are the names and addressed of all clients?
book_1
SELECT title , isbn , SalePrice FROM Book
List all Book titles, ISBNs, and sale prices.
book_1
SELECT title , isbn , SalePrice FROM Book
What are the titles, ISBNs, and sale prices for all books?
book_1
SELECT count(*) FROM Book
How many books do we have?
book_1
SELECT count(*) FROM Book
Count the number of books.
book_1
SELECT count(*) FROM Author
How many authors are there?
book_1
SELECT count(*) FROM Author
Count the number of authors.
book_1
SELECT count(*) FROM Client
How many clients are there?
book_1
SELECT count(*) FROM Client
Return the number of clients.
book_1
SELECT name , address FROM Client ORDER BY name
List names and addresses of all clients in alphabetical order by their names.
book_1
SELECT name , address FROM Client ORDER BY name
What are the names and addressed of all clients, ordered alphabetically by name?
book_1
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
Show all book titles and corresponding author names.
book_1
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
What are the names of all books and their corresponding authors?
book_1
SELECT T1.idOrder , T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient = T2.idClient
Show all order ids and their client names.
book_1
SELECT T1.idOrder , T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient = T2.idClient
What are the ids of all orders and the corresponding client names?
book_1
SELECT T1.name , count(*) FROM Author AS T1 JOIN Author_Book AS T2 ON T1.idAuthor = T2.Author GROUP BY T1.idAuthor
Show all author names and the numbers of books each has written.
book_1
SELECT T1.name , count(*) FROM Author AS T1 JOIN Author_Book AS T2 ON T1.idAuthor = T2.Author GROUP BY T1.idAuthor
What are the names of all the authors, and how many books has each written?
book_1
SELECT isbn , count(*) FROM Books_Order GROUP BY isbn
Show all book isbns and the numbers of orders for each.
book_1
SELECT isbn , count(*) FROM Books_Order GROUP BY isbn
What are all isbns for each book, and how many times has each been ordered?
book_1
SELECT isbn , sum(amount) FROM Books_Order GROUP BY isbn
Show all book isbns and the total amount ordered for each.
book_1
SELECT isbn , sum(amount) FROM Books_Order GROUP BY isbn
What are the isbns for all books, and what is the total amount ordered for each?
book_1
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
Show the book title corresponding to the book with the most number of orders.
book_1
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
What is the title of the book that has been ordered the greatest number of times?
book_1
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
Show the book title and purchase price of the book that has had the greatest amount in orders.
book_1
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
What is the title and purchase price of the book that has the highest total order amount?
book_1
SELECT DISTINCT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn = T2.isbn
Show the titles of books that have been ordered.
book_1
SELECT DISTINCT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn = T2.isbn
What are the different titles of books that have been ordered in the past?
book_1
SELECT DISTINCT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient = T2.idClient
Show the names of clients who have ordered at least once.
book_1
SELECT DISTINCT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient = T2.idClient
What are the names of the different clients who have made an order?
book_1
SELECT T2.name , count(*) FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient = T2.idClient GROUP BY T1.idClient
Show all client names and the number of orders each has made.
book_1
SELECT T2.name , count(*) FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient = T2.idClient GROUP BY T1.idClient
What are the names of all the clients, and how many times has each of them ordered?
book_1
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
What is the name of the client with the most number of orders?
book_1
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
Give the name of the client who has made the most orders.
book_1
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
Show the client names and their total amounts of books ordered.
book_1
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
What are the names of all the clients, and the total amount of books ordered by each?
book_1
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
Show the client name who has the most total amount of books ordered.
book_1
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
What is the name of the client who has ordered the greatest total amount of books?
book_1
SELECT title FROM book EXCEPT SELECT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn = T2.isbn
Show all book titles for books that have no orders.
book_1
SELECT title FROM book EXCEPT SELECT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn = T2.isbn
What are the titles of books that have never been ordered?
book_1
SELECT name FROM Client EXCEPT SELECT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient = T2.idClient
Show all client names for clients who have not made orders.
book_1
SELECT name FROM Client EXCEPT SELECT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient = T2.idClient
What are the names of clients who have never made an order?
book_1
SELECT max(saleprice) , min(saleprice) FROM Book
What is the maximum and the minimum sale price?
book_1
SELECT max(saleprice) , min(saleprice) FROM Book
Give the maximum and minimum sale price of books.
book_1
SELECT avg(purchaseprice) , avg(saleprice) FROM Book
What is the average purchase price and the average sale price?
book_1
SELECT avg(purchaseprice) , avg(saleprice) FROM Book
Give the average purchase price and average sale price for books.
book_1
SELECT max(saleprice - purchaseprice) FROM Book
What is the maximum difference between the sale price and purchase price?
book_1
SELECT max(saleprice - purchaseprice) FROM Book
Return the largest difference in sale price and purchase price.
book_1
SELECT title FROM book WHERE saleprice > (SELECT avg(saleprice) FROM book)
List all book titles which have sale prices higher than the average.
book_1
SELECT title FROM book WHERE saleprice > (SELECT avg(saleprice) FROM book)
What are the titles of books with sale prices above the average sale price across all books?
book_1
select title from book order by saleprice asc limit 1
List all book titles which have the lowest sale price .
book_1
select title from book order by saleprice asc limit 1
What are the titles of books that have a sale price equal to the lowest sale price across all books ?
book_1
select title from book order by purchaseprice desc limit 1
List all book titles which have highest purchase prices .
book_1
select title from book order by purchaseprice desc limit 1
What are the titles of books with the highest purchase price across all books ?
book_1
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"
What is the average sale price of books written by George Orwell?
book_1
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"
Give the average sale price of books authored by George Orwell.
book_1
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"
What are sale prices of books written by Plato?
book_1
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"
Return the sale prices of books authored by Plato.
book_1
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
What is the title of the book written by George Orwell that has the lowest sale price?
book_1
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
Give the title of book by George Orwell that has the lowest saleprice.
book_1
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)
What is the title of the book written by Plato has price lower than the average sale price of all books?
book_1
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)
Give the titles of books authored by Plato that have a sale price lower than the average sale price across all books.
book_1
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"
Who is the author of the book "Pride and Prejudice"?
book_1
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"
Give the name of the author who wrote the book titled Pride and Prejudice.
book_1
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%"
List titles of all books published by an author whose name contains the string 'Plato'?
book_1
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%"
What are the titles of all books written by an author with a name that contains Plato?
book_1
SELECT count(*) FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn = T2.isbn WHERE T1.title = "Pride and Prejudice"
How many orders do we have for "Pride and Prejudice"?
book_1
SELECT count(*) FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn = T2.isbn WHERE T1.title = "Pride and Prejudice"
Return the number of orders received for Pride and Prejudice.
book_1
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"
Show ids for orders including both "Pride and Prejudice" and "The Little Prince".
book_1
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"
What are the order ids for orders that include both Pride and Prejudice and The Little Prince?
book_1
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"
Show all book isbns which were ordered by both client Peter Doe and client James Smith.
book_1
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"
What are the isbns of books ordered by both clients named Peter Doe and James Smith?
book_1
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"
Find the title of books which are ordered by client Peter Doe but not client James Smith.
book_1
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"
What are the titles of books that the client Peter Doe ordered, but the client James Smith did not?
book_1
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"
Show all client names who have orders for "Pride and Prejudice".
book_1
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"
What are the names of clients who have ordered Pride and Prejudice?
book_review
SELECT count(*) FROM book
How many books are there?
book_review
SELECT Title FROM book ORDER BY Title ASC
List the titles of books in ascending alphabetical order.
book_review
SELECT Title FROM book ORDER BY Pages DESC
List the titles of books in descending order of pages.
book_review
SELECT TYPE , Release FROM book
What are the types and release dates of books?
book_review
SELECT max(Chapters) , min(Chapters) FROM book
What are the maximum and minimum number of chapters for each book?
book_review
SELECT Title FROM book WHERE TYPE != "Poet"
What are the titles of books that are not "Poet"?
book_review
SELECT avg(Rating) FROM review
What is the average rating in reviews?