Ok, thanks !

There are certainly good reasons for that, but I find it surprising at first 
sight.

Pierre


> That's SQL standard -- query with aggregate functions always return at
> least one row.
> 
>> 
>> [tested under 3.6.12 and 3.7.15.2]
>> 
>> I have a question regarding the use of aggregate functions.
>> 
>> Let's imagine the following db :
>>> create table A (id1 INTEGER UNIQUE PRIMARY KEY, id2 INTEGER);
>> It is empty.
>> 
>> The following query :
>>> select id1,id2 from A;
>> returns nothing, there is no row.
>> 
>> However, the following query, using the aggregate min() :
>>> select min(id1),id2 from A;
>> returns an empty line (displays '|' in the shell).
>> 
>> Using avg(), max()... will do the same.
>> 
>> With the C interface, SQLITE_ROW is returned, and I must test 
>> sqlite_column_type() against SQLITE_NULL to check that in fact, there is no 
>> result.
>> 
>> Is this expected behaviour ?

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

Reply via email to