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 |
---|---|---|---|---|---|
500 |
cre_Students_Information_Systems
|
[
"transcripts",
"teachers",
"classes"
] |
Find the details of the teachers who have taught the student with the earliest transcript issuance.
|
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
|
501 |
cre_Students_Information_Systems
|
[
"student_loans"
] |
How much total loan does each student have ? List the student ids and the amounts .
|
select student_id , sum(amount_of_loan) from student_loans group by student_id
|
medium
|
502 |
cre_Students_Information_Systems
|
[
"student_loans"
] |
For each student, find the student id and the total amount of loan he or she has.
|
SELECT student_id , sum(amount_of_loan) FROM Student_Loans GROUP BY student_id
|
medium
|
503 |
cre_Students_Information_Systems
|
[
"classes",
"students"
] |
How many courses does each student take? List the student id, the student biographical data and the course count.
|
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
|
medium
|
504 |
cre_Students_Information_Systems
|
[
"classes",
"students"
] |
For each student, find the student id, student biographical data, and the number of courses he or she takes.
|
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
|
medium
|
505 |
cre_Students_Information_Systems
|
[
"detention"
] |
How many students have gone through a detention?
|
SELECT count(DISTINCT student_id) FROM Detention
|
easy
|
506 |
cre_Students_Information_Systems
|
[
"detention"
] |
Count the number of students who have a detention record.
|
SELECT count(DISTINCT student_id) FROM Detention
|
easy
|
507 |
cre_Students_Information_Systems
|
[
"ref_address_types",
"students_addresses"
] |
What is the code and description of the most common student address type?
|
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
|
extra
|
508 |
cre_Students_Information_Systems
|
[
"ref_address_types",
"students_addresses"
] |
What is the most common student address type? Give me the code and description of the address type.
|
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
|
extra
|
509 |
cre_Students_Information_Systems
|
[
"student_loans",
"student_events",
"students"
] |
For those students who have gone through an event, who do not have a student loan? List the students' biographical data
|
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
|
extra
|
510 |
cre_Students_Information_Systems
|
[
"student_loans",
"student_events",
"students"
] |
Among the students who have an event record, who do not have a student loan? Return the students' biographical data.
|
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
|
extra
|
511 |
cre_Students_Information_Systems
|
[
"transcripts",
"students_addresses"
] |
List the start time and the end time of the students' addresses for the students who have 2 transcripts.
|
SELECT date_from , date_to FROM Students_Addresses WHERE student_id IN ( SELECT student_id FROM Transcripts GROUP BY student_id HAVING count(*) = 2 )
|
extra
|
512 |
cre_Students_Information_Systems
|
[
"transcripts",
"students_addresses"
] |
What are the start time and end time of addresses for the students who receive 2 transcripts?
|
SELECT date_from , date_to FROM Students_Addresses WHERE student_id IN ( SELECT student_id FROM Transcripts GROUP BY student_id HAVING count(*) = 2 )
|
extra
|
513 |
cre_Students_Information_Systems
|
[
"detention"
] |
When did all the detentions start?
|
SELECT datetime_detention_start FROM Detention
|
easy
|
514 |
cre_Students_Information_Systems
|
[
"detention"
] |
Give me the detention start date for all the detention records.
|
SELECT datetime_detention_start FROM Detention
|
easy
|
515 |
book_1
|
[
"author"
] |
List all the author names.
|
SELECT name FROM Author
|
easy
|
516 |
book_1
|
[
"author"
] |
What are the names of all the authors?
|
SELECT name FROM Author
|
easy
|
517 |
book_1
|
[
"client"
] |
Show all Client names and their addresses.
|
SELECT name , address FROM Client
|
medium
|
518 |
book_1
|
[
"client"
] |
What are the names and addressed of all clients?
|
SELECT name , address FROM Client
|
medium
|
519 |
book_1
|
[
"book"
] |
List all Book titles, ISBNs, and sale prices.
|
SELECT title , isbn , SalePrice FROM Book
|
medium
|
520 |
book_1
|
[
"book"
] |
What are the titles, ISBNs, and sale prices for all books?
|
SELECT title , isbn , SalePrice FROM Book
|
medium
|
521 |
book_1
|
[
"book"
] |
How many books do we have?
|
SELECT count(*) FROM Book
|
easy
|
522 |
book_1
|
[
"book"
] |
Count the number of books.
|
SELECT count(*) FROM Book
|
easy
|
523 |
book_1
|
[
"author"
] |
How many authors are there?
|
SELECT count(*) FROM Author
|
easy
|
524 |
book_1
|
[
"author"
] |
Count the number of authors.
|
SELECT count(*) FROM Author
|
easy
|
525 |
book_1
|
[
"client"
] |
How many clients are there?
|
SELECT count(*) FROM Client
|
easy
|
526 |
book_1
|
[
"client"
] |
Return the number of clients.
|
SELECT count(*) FROM Client
|
easy
|
527 |
book_1
|
[
"client"
] |
List names and addresses of all clients in alphabetical order by their names.
|
SELECT name , address FROM Client ORDER BY name
|
medium
|
528 |
book_1
|
[
"client"
] |
What are the names and addressed of all clients, ordered alphabetically by name?
|
SELECT name , address FROM Client ORDER BY name
|
medium
|
529 |
book_1
|
[
"author_book",
"author",
"book"
] |
Show all book titles and corresponding author names.
|
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
|
medium
|
530 |
book_1
|
[
"author_book",
"author",
"book"
] |
What are the names of all books and their corresponding authors?
|
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
|
medium
|
531 |
book_1
|
[
"orders",
"client"
] |
Show all order ids and their client names.
|
SELECT T1.idOrder , T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient = T2.idClient
|
medium
|
532 |
book_1
|
[
"orders",
"client"
] |
What are the ids of all orders and the corresponding client names?
|
SELECT T1.idOrder , T2.name FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient = T2.idClient
|
medium
|
533 |
book_1
|
[
"author_book",
"author"
] |
Show all author names and the numbers of books each has written.
|
SELECT T1.name , count(*) FROM Author AS T1 JOIN Author_Book AS T2 ON T1.idAuthor = T2.Author GROUP BY T1.idAuthor
|
medium
|
534 |
book_1
|
[
"author_book",
"author"
] |
What are the names of all the authors, and how many books has each written?
|
SELECT T1.name , count(*) FROM Author AS T1 JOIN Author_Book AS T2 ON T1.idAuthor = T2.Author GROUP BY T1.idAuthor
|
medium
|
535 |
book_1
|
[
"books_order"
] |
Show all book isbns and the numbers of orders for each.
|
SELECT isbn , count(*) FROM Books_Order GROUP BY isbn
|
medium
|
536 |
book_1
|
[
"books_order"
] |
What are all isbns for each book, and how many times has each been ordered?
|
SELECT isbn , count(*) FROM Books_Order GROUP BY isbn
|
medium
|
537 |
book_1
|
[
"books_order"
] |
Show all book isbns and the total amount ordered for each.
|
SELECT isbn , sum(amount) FROM Books_Order GROUP BY isbn
|
medium
|
538 |
book_1
|
[
"books_order"
] |
What are the isbns for all books, and what is the total amount ordered for each?
|
SELECT isbn , sum(amount) FROM Books_Order GROUP BY isbn
|
medium
|
539 |
book_1
|
[
"book",
"books_order"
] |
Show the book title corresponding to the book with the most number of orders.
|
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
|
extra
|
540 |
book_1
|
[
"book",
"books_order"
] |
What is the title of the book that has been ordered the greatest number of times?
|
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
|
extra
|
541 |
book_1
|
[
"book",
"books_order"
] |
Show the book title and purchase price of the book that has had the greatest amount in orders.
|
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
|
extra
|
542 |
book_1
|
[
"book",
"books_order"
] |
What is the title and purchase price of the book that has the highest total order amount?
|
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
|
extra
|
543 |
book_1
|
[
"books_order",
"book"
] |
Show the titles of books that have been ordered.
|
SELECT DISTINCT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn = T2.isbn
|
easy
|
544 |
book_1
|
[
"books_order",
"book"
] |
What are the different titles of books that have been ordered in the past?
|
SELECT DISTINCT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn = T2.isbn
|
easy
|
545 |
book_1
|
[
"orders",
"client"
] |
Show the names of clients who have ordered at least once.
|
SELECT DISTINCT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient = T2.idClient
|
easy
|
546 |
book_1
|
[
"orders",
"client"
] |
What are the names of the different clients who have made an order?
|
SELECT DISTINCT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient = T2.idClient
|
easy
|
547 |
book_1
|
[
"orders",
"client"
] |
Show all client names and the number of orders each has made.
|
SELECT T2.name , count(*) FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient = T2.idClient GROUP BY T1.idClient
|
medium
|
548 |
book_1
|
[
"orders",
"client"
] |
What are the names of all the clients, and how many times has each of them ordered?
|
SELECT T2.name , count(*) FROM Orders AS T1 JOIN Client AS T2 ON T1.idClient = T2.idClient GROUP BY T1.idClient
|
medium
|
549 |
book_1
|
[
"orders",
"client"
] |
What is the name of the client with the most number of orders?
|
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
|
extra
|
550 |
book_1
|
[
"orders",
"client"
] |
Give the name of the client who has made the most orders.
|
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
|
extra
|
551 |
book_1
|
[
"orders",
"client",
"books_order"
] |
Show the client names and their total amounts of books ordered.
|
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
|
hard
|
552 |
book_1
|
[
"orders",
"client",
"books_order"
] |
What are the names of all the clients, and the total amount of books ordered by each?
|
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
|
hard
|
553 |
book_1
|
[
"orders",
"client",
"books_order"
] |
Show the client name who has the most total amount of books ordered.
|
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
|
extra
|
554 |
book_1
|
[
"orders",
"client",
"books_order"
] |
What is the name of the client who has ordered the greatest total amount of books?
|
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
|
extra
|
555 |
book_1
|
[
"books_order",
"book"
] |
Show all book titles for books that have no orders.
|
SELECT title FROM book EXCEPT SELECT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn = T2.isbn
|
hard
|
556 |
book_1
|
[
"books_order",
"book"
] |
What are the titles of books that have never been ordered?
|
SELECT title FROM book EXCEPT SELECT T1.title FROM book AS T1 JOIN books_order AS T2 ON T1.isbn = T2.isbn
|
hard
|
557 |
book_1
|
[
"orders",
"client"
] |
Show all client names for clients who have not made orders.
|
SELECT name FROM Client EXCEPT SELECT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient = T2.idClient
|
hard
|
558 |
book_1
|
[
"orders",
"client"
] |
What are the names of clients who have never made an order?
|
SELECT name FROM Client EXCEPT SELECT T1.name FROM Client AS T1 JOIN Orders AS T2 ON T1.idClient = T2.idClient
|
hard
|
559 |
book_1
|
[
"book"
] |
What is the maximum and the minimum sale price?
|
SELECT max(saleprice) , min(saleprice) FROM Book
|
medium
|
560 |
book_1
|
[
"book"
] |
Give the maximum and minimum sale price of books.
|
SELECT max(saleprice) , min(saleprice) FROM Book
|
medium
|
561 |
book_1
|
[
"book"
] |
What is the average purchase price and the average sale price?
|
SELECT avg(purchaseprice) , avg(saleprice) FROM Book
|
medium
|
562 |
book_1
|
[
"book"
] |
Give the average purchase price and average sale price for books.
|
SELECT avg(purchaseprice) , avg(saleprice) FROM Book
|
medium
|
563 |
book_1
|
[
"book"
] |
What is the maximum difference between the sale price and purchase price?
|
SELECT max(saleprice - purchaseprice) FROM Book
|
easy
|
564 |
book_1
|
[
"book"
] |
Return the largest difference in sale price and purchase price.
|
SELECT max(saleprice - purchaseprice) FROM Book
|
easy
|
565 |
book_1
|
[
"book"
] |
List all book titles which have sale prices higher than the average.
|
SELECT title FROM book WHERE saleprice > (SELECT avg(saleprice) FROM book)
|
hard
|
566 |
book_1
|
[
"book"
] |
What are the titles of books with sale prices above the average sale price across all books?
|
SELECT title FROM book WHERE saleprice > (SELECT avg(saleprice) FROM book)
|
hard
|
567 |
book_1
|
[
"book"
] |
List all book titles which have the lowest sale price .
|
select title from book order by saleprice asc limit 1
|
medium
|
568 |
book_1
|
[
"book"
] |
What are the titles of books that have a sale price equal to the lowest sale price across all books ?
|
select title from book order by saleprice asc limit 1
|
medium
|
569 |
book_1
|
[
"book"
] |
List all book titles which have highest purchase prices .
|
select title from book order by purchaseprice desc limit 1
|
medium
|
570 |
book_1
|
[
"book"
] |
What are the titles of books with the highest purchase price across all books ?
|
select title from book order by purchaseprice desc limit 1
|
medium
|
571 |
book_1
|
[
"author",
"author_book",
"book"
] |
What is the average sale price of books written by George Orwell?
|
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"
|
hard
|
572 |
book_1
|
[
"author",
"author_book",
"book"
] |
Give the average sale price of books authored by George Orwell.
|
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"
|
hard
|
573 |
book_1
|
[
"author",
"author_book",
"book"
] |
What are sale prices of books written by Plato?
|
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"
|
hard
|
574 |
book_1
|
[
"author",
"author_book",
"book"
] |
Return the sale prices of books authored by Plato.
|
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"
|
hard
|
575 |
book_1
|
[
"author",
"author_book",
"book"
] |
What is the title of the book written by George Orwell that has the lowest sale price?
|
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
|
extra
|
576 |
book_1
|
[
"author",
"author_book",
"book"
] |
Give the title of book by George Orwell that has the lowest saleprice.
|
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
|
extra
|
577 |
book_1
|
[
"author",
"author_book",
"book"
] |
What is the title of the book written by Plato has price lower than the average sale price of all books?
|
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)
|
extra
|
578 |
book_1
|
[
"author",
"author_book",
"book"
] |
Give the titles of books authored by Plato that have a sale price lower than the average sale price across all books.
|
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)
|
extra
|
579 |
book_1
|
[
"author",
"author_book",
"book"
] |
Who is the author of the book "Pride and Prejudice"?
|
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"
|
hard
|
580 |
book_1
|
[
"author",
"author_book",
"book"
] |
Give the name of the author who wrote the book titled Pride and Prejudice.
|
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"
|
hard
|
581 |
book_1
|
[
"author",
"author_book",
"book"
] |
List titles of all books published by an author whose name contains the string 'Plato'?
|
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%"
|
extra
|
582 |
book_1
|
[
"author",
"author_book",
"book"
] |
What are the titles of all books written by an author with a name that contains Plato?
|
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%"
|
extra
|
583 |
book_1
|
[
"book",
"books_order"
] |
How many orders do we have for "Pride and Prejudice"?
|
SELECT count(*) FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn = T2.isbn WHERE T1.title = "Pride and Prejudice"
|
medium
|
584 |
book_1
|
[
"book",
"books_order"
] |
Return the number of orders received for Pride and Prejudice.
|
SELECT count(*) FROM Book AS T1 JOIN Books_Order AS T2 ON T1.isbn = T2.isbn WHERE T1.title = "Pride and Prejudice"
|
medium
|
585 |
book_1
|
[
"book",
"books_order"
] |
Show ids for orders including both "Pride and Prejudice" and "The Little Prince".
|
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"
|
extra
|
586 |
book_1
|
[
"book",
"books_order"
] |
What are the order ids for orders that include both Pride and Prejudice and The Little Prince?
|
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"
|
extra
|
587 |
book_1
|
[
"orders",
"client",
"books_order"
] |
Show all book isbns which were ordered by both client Peter Doe and client James Smith.
|
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"
|
extra
|
588 |
book_1
|
[
"orders",
"client",
"books_order"
] |
What are the isbns of books ordered by both clients named Peter Doe and James Smith?
|
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"
|
extra
|
589 |
book_1
|
[
"orders",
"book",
"client",
"books_order"
] |
Find the title of books which are ordered by client Peter Doe but not client James Smith.
|
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"
|
extra
|
590 |
book_1
|
[
"orders",
"book",
"client",
"books_order"
] |
What are the titles of books that the client Peter Doe ordered, but the client James Smith did not?
|
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"
|
extra
|
591 |
book_1
|
[
"orders",
"book",
"client",
"books_order"
] |
Show all client names who have orders for "Pride and Prejudice".
|
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"
|
extra
|
592 |
book_1
|
[
"orders",
"book",
"client",
"books_order"
] |
What are the names of clients who have ordered Pride and Prejudice?
|
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"
|
extra
|
593 |
book_review
|
[
"book"
] |
How many books are there?
|
SELECT count(*) FROM book
|
easy
|
594 |
book_review
|
[
"book"
] |
List the titles of books in ascending alphabetical order.
|
SELECT Title FROM book ORDER BY Title ASC
|
easy
|
595 |
book_review
|
[
"book"
] |
List the titles of books in descending order of pages.
|
SELECT Title FROM book ORDER BY Pages DESC
|
easy
|
596 |
book_review
|
[
"book"
] |
What are the types and release dates of books?
|
SELECT TYPE , Release FROM book
|
medium
|
597 |
book_review
|
[
"book"
] |
What are the maximum and minimum number of chapters for each book?
|
SELECT max(Chapters) , min(Chapters) FROM book
|
medium
|
598 |
book_review
|
[
"book"
] |
What are the titles of books that are not "Poet"?
|
SELECT Title FROM book WHERE TYPE != "Poet"
|
easy
|
599 |
book_review
|
[
"review"
] |
What is the average rating in reviews?
|
SELECT avg(Rating) FROM review
|
easy
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.