James K. Lowden wrote: > 1. Last I checked, SELECT in a column position in the SELECT clause as > in > > select foo (select ...) > > is not permitted by the SQL standard.
This example indeed is not valid SQL syntax. However, SELECT in a column position is allowed: select (select 42); This is called a scalar subquery, and it's allowed in place of any expression. (The SQL standard requires it to return exactly one row.) > 1. Is the left-join on a CTE apt to be more effecient than the version > that uses a correlated subquery in the SELECT clause? Some databases' query optimizers can do a better job with joins than with subqueries. In SQLite, left joins and correlated subqueries are executed in exactly the same way. > 2. Is there any performance difference between > > sum(ca1 +ca2 + exam) > and > sum(ca1) + sum(ca2) + sum(exam) The second one will do three aggregations in parallel, but I'd expect the difference to be too small to be noticeable. Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users