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

I\'m having a problem with SQL. Can someone help? Here\'s what I have to do: Thi

ID: 3545432 • Letter: I

Question

I'm having a problem with SQL.  Can someone help? Here's what I have to do:


This is the question as posed to me.  Using the tables in my database, I'm supposed to write an SQL query showing.....

               "...The store name, address, city, state, zip, and quantity of books sold in that store for each store.   Place the list in descending order by the quantity of books sold..."


  Ok.  Got it.  Here's what I have so far:


SELECT     stores.stor_name, stores.stor_address, stores.city, stores.state, stores.zip, sales.qty

FROM         sales INNER JOIN

                      stores ON sales.stor_id = stores.stor_id

ORDER BY sales.qty DESC



BUT, here's the problem:  I'm NOT supposed to use INNER JOIN.  

How do I write the above out WITHOUT using INNER JOIN?????

Explanation / Answer

if you dont want to user the word inner join and has to keep the same concept of inner join then the answer is


SELECT stores.stor_name, stores.stor_address, stores.city, stores.state, stores.zip, sales.qty

FROM sales ,

stores

where sales.stor_id = stores.stor_id

ORDER BY sales.qty DESC


or if you want to remove the inner join concept and has to get the same result then


SELECT stores.stor_name, stores.stor_address, stores.city, stores.state, stores.zip,

(select qty from stores where sales.stor_id = stores.stor_id) as qty

FROM sales

ORDER BY qty DESC

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