Basic SQL Questions
476840Dec 15 2005 — edited Dec 15 2005Hello,
For my economical study I need to answer some questions concerning SQL. Some of the questions are quite easy but most are really hard. (At least for a SQL newbie like me).
I would like to post a question concerning SQL here.
I need to know the average purchase price of a wiskey bottle. Therefore I need to use the following database tables:
Product: productname, productgroup
Brand: brandnumber, productgroup, name,areacode,color,alcoholperc.
Stock: articlecode,brandnumber,year,suitcode,adviced-sale-price,instock
Purchase: ordernumber, articlecode,purchasenumber,purchaseprice.
This are the tables I think I need. First I need to find out what articlecodes belong to bottles of wiskey. Thereafter I must "connect" them to the average price. This far I have come. I tried to use the "AVG" command but that didn't really work out with all the relations between the tables.
I think I need to use an Sub-Query but I don't really have an idea of how to?
Any kind of help would be kindly appreciated.
Ben
P.S. I did translate the table names from Dutch, so please excuse my average English