SELECT COUNT(QUANTITY)
i just got back from an interview with another local company after
being invited by their CEO to explore my opportunities with them.
it was unexpected that i scheduled for an interview today and you can
find the reason on my personal blog (if you have the link).
exam was not that hard and what caught me was this sql statement
exercise to total the quantities of a given purchase order with some
table joins. i was surprised when the project lead asked me if i
have experience with query statements and i answered yes since i have
been using it a lot in all of my previous projects. turns out
that i used
SELECT COUNT(QUANTITY) instead of
SELECT SUM(QUANTITY). i was laughing and i'm glad she didn't have it against me.
what was going around my head when i answered that question was "
i need to get the total count of a particular item" which is the reason why i used
COUNT aggregate function. so beware of the same mistake!