Re: PostgreSQL v Informix
Posted in 1997
In article <3394902B.769B@west.co.za>, "Mark D. Stock" <marks@west.co.za> writes: > Kerry Sainsbury wrote: > > > > While Informix does return a NULL on a SUM of no rows, and I assume that's > > in the SQL standard somewhere, can anybody explain to me *why*? > > > > If my question is: > > > > SELECT SUM(quantity_sold) FROM orders WHERE city = "Tokoroa" > > > > and I've not sold anything in Tokoroa, shouldn't the answer be zero? > > The answer isn't "undefined" or "unknown", is it? Hmmm, maybe it *is* > > undefined, but it still doesn't really make sense to me. > > If you have no record of sales in "Tokoroa", then the total is > "unknown". If you had records detailing zero sales in "Tokoroa", > then yes, the total would be zero. Seems to me that by that logic ALL answers should be NULL as you are assuming that the database cannot be depended upon as a complete record of sales? <SNIP> > Cheers, > -- > Mark. > ---------------------------------------------------------------------- David Paulo, InForm Group Ltd.,PO Box 1444, Wellington, New Zealand. Ph: +64 4 472 0996 Fax: +64 4 473 2407 Email: david@inform.co.nz = What would you do if you knew that you could not fail = ----------------------------------------------------------------------