MySQL Database Tutorial – 20 – Subqueries




Facebook – https://www.facebook.com/TheNewBoston-464114846956315/ GitHub – https://github.com/buckyroberts Google+ …

Original source


33 responses to “MySQL Database Tutorial – 20 – Subqueries”

  1. could have mentioned how writing the AVG function as a sub query allows the calculation to stay 'up-to-date' and that a static avg value changes, causing this to be a good solution for a repeated query.

  2. I think he means it is a useless example because there is an easier way to code it. A good coder would write this same query in a simpler manner. It is a good example in that it shows how subqueries work, but a bad example in that does not show how a similar query should be coded. Thanks for your work, Bucky! 

  3. This is not an useless query because if one the costs changes,then the value of 423 will no longer gives you the exact average of cost,so doing it as you did is the most effiient way (aside from using the AVG funcion on the cost column). *Inception!*…. Nice explained, thank you!

Leave a Reply