> > Otherwise, you must enlighten me on how it could have a practical use
> > to have an arbitrary value in the group returned together with the
> > total number of records across all the groups.
> 
> It's not useful in your specific query, but it is useful in others. Yours
is not the
> only system in the world that uses SQLite, you know.
> 

Igor, I did not mean to belittle SQLite (or the very good work that you are
doing on this e-mail list).
In fact, I think it is a fantastic tool which can be used for many purposes.


When I write as I do, it is after weighing the advantage of this "feature"
against the disadvantages. 

As for the advantages, I just don't see how it could be practical to have an
arbitrary group value together with the total number of records in an
application. But sometimes a feature / error that was not intended finds its
way into an application and so it is still supported in later versions. I
guess it could be so. Or perhaps it can be useful in applications of a
different type than I have been involved in.

On the downside I often see mistakes of left out elements in group by
clauses, and then it is a blessing to have it pointed out by the compiler
rather than having an erroneous result as in the example.  This is
especially the case when the query may have a complex group by clauses of
many elements and perhaps even derived tables (e.g. select ... from (select
.. from) left join (select ..), etc. In these cases it is so very easy to
leave out a single field -- and I admit that I have sometimes been saved by
the compiler. Now the query might generate data that are used directly in
the application or perhaps even fed to further queries after storage, and so
an error like that may propagate through the system.
But even for simple queries it is a common mistake -- especially for someone
new to SQL.

Thus weighing for and against considering everybody, I find that it would be
better not to have this "feature" but rather have the compiler return an
error. Those who might be dependent upon the "feature" could have an option
to enable it. I simply find that most would benefit from that - experienced
as well people new to SQL / SQLite.

Also, I think that if you need an arbitrary value it would be better to get
that explicitly through usage of the random function. The other way is more
obscure and is bad SQL code (in my opinion ;-).

So I hope that there could be a way to not have this behaviour, but in the
meantime I will check my SELECT statements like a hawk ;-)


Best regards

Frank

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

Reply via email to