0

SQL Intermediate Practice Question

Need help with SQL Intermediate Practice question Number of Books How do I get the null records to show with the other records SELECT A.name, COUNT (B.id) AS books FROM Authors AS A JOIN Books AS B ON A.id= B.author_id GROUP BY A.name, B.id ORDER BY A.name ASC, B.id DESC

17th Sep 2024, 4:47 PM
Danielle Strahan
2 Respuestas
+ 2
Danielle Strahan the question states 0 as count not " null " which represents there is nothing there ... 0 is a number SELECT A.name, count(B.id) as books FROM Books AS B RIGHT JOIN Authors AS A ON B.author_id = A.id GROUP By A.name ORDER By books desc example 1: SELECT product_id FROM products WHERE quantity = 0; example 2: SELECT product_id FROM products WHERE price IS NULL;
17th Sep 2024, 6:16 PM
BroFar
BroFar - avatar