On Mon, 21 Nov 2016 20:46:45 +0000
David Raymond <david.raym...@tomtom.com> wrote:

> insert into main.foo
> select db1.foo.*
> from db1.foo left outer join db2.bar
> on db1.foo.pk = db2.bar.pk
> where db2.bar.pk is null;

Just by the way, your query could be cast as 

insert into main.foo
select * 
from db1.foo where not exists (
        select 1 from db2.bar
        on db1.foo.pk = pk 
);

Although DRH's points regarding "select *" are well founded, there are
good uses for it, and yours is one.  In this case, the tables "main"
and "foo" are supposed to have the same columns.  "select *" propagates
that symmetry if foo is altered.  Whether or not that's actually
desirable depends on how "main" is defined, on its meaning in the mind
fo the designer.  

IMO the criticism of "select *" is sometimes overwrought.  An
application that uses columns by name -- as it should -- will not fail
in the face of extra columns.  The efficiency gain could be small or
large, depending.  It's a good guideline, but doesn't deserve
veneration in all circumstances.  

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

Reply via email to