Hi, 

Besides the most excellent explanation given by Keith Medcalf, I want to point 
out a couple of (hopefully) helpful things –

1. Contrary to your subject line, SQLite actually does give a feedback/returns 
something. It is just not good enough (for many of us). Consider the following:

```
○ → sqlite3
SQLite version 3.30.0 2019-10-04 15:03:17
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> SELECT 30 / 2;
15
sqlite> SELECT 30 / 57;
0
sqlite> SELECT 55 / 0;

sqlite>
```

See that blank line after the last operation? That is SQLite “printing” out a 
NULL value. The `.nullvalue STRING` setting in the command line client can 
change that blank like to something more visual/meaningful.

2. The `typeof()` operator is super. It is like the detective cousin of CAST(). 
The latter allows you to change the type of a data value and the former allows 
you to find out the typeof data.

```
sqlite> SELECT typeof(55 / 0);
null
sqlite> SELECT typeof(30 / 2);
integer
sqlite> SELECT typeof(30.0 / 55);
real
sqlite> SELECT 30.0 / 55;
0.545454545454545
sqlite>
```

Good luck. And nice question as it reminded us of this math idiosyncrasy of 
SQLite.

> On Mar 10, 2020, at 8:21 AM, Octopus ZHANG <zhangysh1...@gmail.com> wrote:
> 
> I try to run a simple math expression, but SQLite gives no feedback :
> 
> sqlite> select 99-(55/(30/57));
> 
> 
> 
> 
> Should I expect it to return nothing?





--
Puneet Kishor
Just Another Creative Commoner
http://punkish.org/About

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

Reply via email to