Jump to content

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

Its practice problems for test review.

the second part of the question builds on the first. So after finding the average price for the types we have to go narrow it down further by if it is a papeback and the average price for the type is greater than $10.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.