Jump to content

subquery problem


pizzaluver13

Recommended Posts

I have Henry Books as a table.

The columns include: TITLE, PRICE, TYPE(SFI, FIC, MYS), PAPERBACK ('Y' or 'N')

so the question is ...

Part 1 -  For each type of book, list the type and the average price.

 

I don't know how to get average price of a type.

 

Part 2 -consider only paperback books for those types of which the average price is more than $10

 

any help will be appreciated...........

Link to comment
https://forums.phpfreaks.com/topic/217697-subquery-problem/
Share on other sites

I have Henry Books as a table.

The columns include: TITLE, PRICE, TYPE(SFI, FIC, MYS), PAPERBACK ('Y' or 'N')

so the question is ...

Part 1 -  For each type of book, list the type and the average price.

 

I don't know how to get average price of a type.

 

Part 2 -consider only paperback books for those types of which the average price is more than $10

 

any help will be appreciated...........

 

Look into GROUP BY.  In your case you want to have groupings by TYPE.  Once you GROUP BY you can use summary functions like AVG().

 

I don't really understand the question for Part 2?

 

 

Is this homework or a test?

Link to comment
https://forums.phpfreaks.com/topic/217697-subquery-problem/#findComment-1130043
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.