Are you trying to create tables with INTEGER PRIMARY KEY? You have to write EXACTLY "integer primary key" (not case specific) to achieve this. The em <=> lo join would probably profit from this.
Your join specifies to compare em.name (a column with numeric affinity) to idv.name (a column with text affinity); this will force SQLite to convert one of the fields for the conversion. Is this what you intended? Maybe you should try to "EXPLAIN QUERY PLAN" to find out what SQLite plans to do.