sqlite-users,

Can anyone please explain the results of the query below? I have tried
create a very simple test case. In brief returning 9 rows each starting
with an integer between zero and nine. Then check if it less than or equal
to five, between zero and five and then less than six. I expect all of
these comparisons to have the same result. I can't understand the results,
and '.explain' isn't any help.

    SQLite version 3.18.0 2017-03-28 18:48:43
    Enter ".help" for usage hints.
    Connected to a transient in-memory database.
    Use ".open FILENAME" to reopen on a persistent database.
    sqlite>
    sqlite> WITH
    ...>     t1(X) AS (
    ...>         SELECT 1
    ...>         UNION ALL
    ...>         SELECT X+1 FROM t1
    ...>         LIMIT 9
    ...>         )
    ...>     ,t2(Y) AS (
    ...>         SELECT abs(random() % 10) FROM t1
    ...>         )
    ...> SELECT Y, Y <= 5, Y BETWEEN 0 AND 5, Y < 6 FROM t2;
    7|1|1|0
    3|1|0|0
    2|1|1|1
    2|0|0|1
    0|1|1|1
    3|1|1|0
    5|1|1|0
    6|1|1|0
    0|1|1|1
    sqlite>

Thanks in advance for your assistance.

Kind Regards

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

Reply via email to