On 15 Sep 2014, at 7:50pm, Dave Wellman <dwell...@ward-analytics.com> wrote:

> Should trying to divide by 0 result in an error?

No.  There's no mechanism for reporting a mathematical error in SQL.  You can 
report malformed commands, references to entities (tables, columns, etc.) which 
don't exist, and complete failure (database corrupt) but you can't report a 
calculation which failed because of the values found.  This means programmers 
don't have to test their error trapping for an unusual unexpected special case.

In the SQL language, NULL is a special value which means 'unknown' or 
'missing'.  I would expect to see the answer to anything involving division by 
zero to be NULL.  Your solution ...

> NULLIF(col3,0)

is fine for your purposes.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to