Richard, Thanks for that, at least I know that what I'm seeing is going to continue.
Simon, I'm really surprised at that. Effectively what this means is that the answer that Sqlite returns may or may not be the correct result. I realise this may only be in a single circumstance but that is still what it means. I suppose we then get into a discussion of what is the 'correct result'. I completely understand that NULL is unknown, but I've always thought that there is a difference between unknown and 'error'. I was always taught in maths that dividing by 0 is not possible (certainly at school, I don't know what happens if you study maths at degree level), the closest that I ever got to an answer for that calculation was 'infinity'. Maybe this is one downside of my working with the same dbms for 20+ years, I've just got used to the way that it works. I realise that there will be differences between dbms's, but now that I'm starting to use sqlite I'm surprised by some of the differences. Thanks for the info. Cheers, Dave Ward Analytics Ltd - information in motion Tel: +44 (0) 118 9740191 Fax: +44 (0) 118 9740192 www: http://www.ward-analytics.com Registered office address: The Oriel, Sydenham Road, Guildford, Surrey, United Kingdom, GU1 3SR Registered company number: 3917021 Registered in England and Wales. -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: 15 September 2014 20:02 To: General Discussion of SQLite Database Subject: Re: [sqlite] Divide by 0 not giving error 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 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users