human
Schema:
book_club (book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result)
movie (movie_id, Title, Year, Director, Budget_million, Gross_worldwide)
culture_company (Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_club_id, movie_id)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the years, book titles, and publishers for all books, in descending order by year.
assistant
SELECT YEAR , book_title , publisher FROM book_club ORDER BY YEAR DESC
human
Show publishers with a book published in 1989 and a book in 1990.
assistant
SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990
human
How many book clubs are there?
assistant
SELECT count(*) FROM book_club
human
Show all distinct publishers for books.
assistant
SELECT DISTINCT publisher FROM book_club
human
What is the publisher with most number of books?
assistant
SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1
human
How many books are there for each publisher?
assistant
SELECT publisher , COUNT( * ) FROM book_club GROUP BY publisher ;