Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the attached query, i have written the below code. WITH BookCounts AS ( SELECT COUNT ( b . bookid ) AS Count, CONCAT (

For the attached query, i have written the below code.
WITH BookCounts AS (
SELECT
COUNT(b.bookid) AS Count,
CONCAT(a.firstname, '', a.lastname) AS AuthorName,
p.publishername AS PublisherName
FROM
Book b
JOIN
Author a ON b.author_id = a.authorid
JOIN
Publisher p ON b.publisherid = p.publisherid
GROUP BY
a.firstname, a.lastname, p.publishername
HAVING
COUNT(b.bookid)>2
)
SELECT * FROM BookCounts
UNION ALL
SELECT 10 AS Count, 'Thomas Cook' AS AuthorName, 'ABSPublisher' AS PublisherName;
This is my output:
+-------+---------------+-------------------+
| COUNT | AUTHORNAME | PUBLISHERNAME |
+-------+---------------+-------------------+
|4| Harvey Deitel | Prentice Hall |
|3| Harvey Deitel | Prentice Hall PTG |
|4| Paul Deitel | Prentice Hall |
|3| Sean Santry | Prentice Hall |
|5| Tem Nieto | Prentice Hall |
|3| Tem Nieto | Prentice Hall PTG |
|10| Thomas Cook | ABSPublisher |
+-------+---------------+-------------------+
Still the testcase is failing, Can you please help to fix this,
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions

Question

Describe various competitive compensation policies.

Answered: 1 week ago