I am not able to solve this problem in solo learn for sql query | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I am not able to solve this problem in solo learn for sql query

User You are working on the library database, which contains the Books and Authors tables. Columns of the Books table: id, name, year, author_id. Columns of the Authors table: id, name. Write a query to get the author names and the number of books they have in the Books table. Note that some authors do not have any books associated with them. In this case, the result needs to include their names and have 0 as the count. The count column should be called books in the result.

24th Nov 2023, 8:18 AM
Lalit Prasad Joshi
Lalit Prasad Joshi - avatar
2 Answers
+ 2
You need to use a left outer join, and connect the two tables by the author_id from the books table, and the id from the authors table. Review the previous lessons and try to use the patterns and techniques that were presented. If still having troubles, then please post your attempts for us to check.
24th Nov 2023, 8:58 AM
Tibor Santa
Tibor Santa - avatar
0
try to see the comments in that part of the lesson. There are a lot of people to help. All the best
24th Nov 2023, 10:15 PM
Hamza A Foji
Hamza A Foji - avatar