question

programmergirl avatar image
programmergirl asked

MYSQL query result with schema

This is the schema:

Books (bookid, title, author, year)

Customers (customerid, name, email)

Purchases (customerid, bookid, year)

Reviews (customerid, bookid, rating)

Pricing (bookid, format, price)

The Question is :

Find Names of the author of 2 or more books written in 1988 and recorded in the database in 1988

MySQL Query that I wrote is:

SELECT author

FROM Books

WHERE year = 1988

GROUP BY author

HAVING count(author)>= 2;

Does it Look Right?? I have no way of testing this because i dont have the data

querymysqlschema
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·

That seems reasonable. Depending on the definition of “recorded in the database” you may need to join on the purchases table

0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.