Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This quetion is about mysql statement. Q. .List all the sales books that are abo

ID: 3688526 • Letter: T

Question

This quetion is about mysql statement.

Q. .List all the sales books that are above the average.

i tried these two statement but, doesn't work

SELECT B.booktitle, B.isbn, B. Publisher, S.sellingPrice AS "Price"

FROM bookdb B , salesdb S               

WHERE B.postingID = S.postingID

AND S.sellingPrice > (SELECT AVG(S.sellingPrice) FROM (SELECT S.sellingPrice FROM salesdb) S)

OR

SELECT B.booktitle, B.isbn, B. Publisher, S.sellingPrice AS "Price"

FROM bookdb AS B , salesdb AS S

WHERE B.postingID = S.postingID

AND S.sellingPrice > (SELECT AVG(S.sellingPrice) FROM (SELECT S.sellingPrice FROM salesdb) S)

plz give me the answer about the question. also plz check if yours work or not!! Thanks.

phpMyAdmin server Local Databases-B Database: vtbookbase »T Browse Structure LPSQL Search ent Favorites postingID sellingPrice | @. O dp EditCopy Delete Edit Copy Delete O Edit Copy Delete Edit 3 Copy Delete i? Edit Copy Delete Edit Copy Delete O Edit Copy Delete Edit Copy Delete i? Edit Copy Delete Edit Copy Delete O Edit Copy Delete Edit 3 Copy Delete i? Edit Copy Delete Edit Copy Delete O Edit Copy Delete Edit Copy Delete i? Edit Copy Delete Edit Copy Delete O Edit Copy Delete Edit Copy Delete i? Edit Copy Delete Edit Copy Delete 2 15.0000 3 50.0000 6 40.0000 7 45.0000 9 40.0000 10 38.0000 11 30.0000 14 35.0000 5 37.0000 17 18.0000 19 30.0000 20 50.0000 21 50.0000 24 60.0000 25 40.0000 26 28.0000 27 34.0000 28 40.0000 29 60.0000 31 50.0000 2 45.0000 33 65.0000 New class information_schema mysql performance schema sys test vt_bookbase op op New buye owner rentaldb op trans renter salesdb salestrans op user op op

Explanation / Answer

This will work

SELECT B.booktitle, B.isbn, B. Publisher, S.sellingPrice AS "Price"

FROM bookdb B inner join salesdb S               

WHERE B.postingID = S.postingID     

AND S.sellingPrice > (SELECT AVG(S.sellingPrice) FROM salesdb S)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote