V
V
Viktoriya2014-12-10 21:57:06
SQL
Viktoriya, 2014-12-10 21:57:06

Select to the database, how to deal with COUNT?

Here's the catch. You need to enter a table that contains a list of books and the number of authors who wrote books in a given genre
. Here is what I did but see an error (
SELECT book.type_book, COUNT(name_author)
FROM author, book WHERE author.author_ID=book.book_ID;
eee60820ef2c4a3380fd089703712a44.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2014-12-10
@gbg

Missing GROUP BY:

SELECT book.type_book, COUNT(author.name_author)
FROM book 
left join author on author.author_ID=book.author_ID
group by book.type_book

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question