On Wed, 09 Sep 2015 09:56:12 +0200
"Domingo Alvarez Duarte" <sqlite-mail at dev.dadbiz.es> wrote:

> With your knowledge could you give your view about how evaluation of
> calculated/function columns should be done to have correct results.  
...
> CREATE TABLE a(b);  
...
> SELECT a, random() as r FROM a WHERE r <> r;  

That's a syntax error, because there is no column a.r.  

Once you reorganize it to make it syntactically valid, the answer
becomes clear:

        select a, r from ( 
                SELECT a, random() as r FROM a   
        ) as R 
        WHERE r <> r;

will yield zero rows, every time.  Whatever value RANDOM produces goes
in the "r" column and any value, including "r", is always equal to
itself.  

--jkl

Reply via email to