On Tue, Jul 6, 2010 at 11:00 AM, Peng Yu <pengyu...@gmail.com> wrote:
> Hi,
>
> I can attach a database to the current session. But I have to
> explicitly specify the table name to refer to any tables in it (such
> 'create_index' in 'create_index.sqlite_master'). Is there a command
> similar to 'use database' (mysql) in sqlite3 so that I can make a
> particular database as default? (I don't find such command, but please
> let me know in case if I miss anything.)
>
> sqlite> attach database 'create_index.db' as create_index;
> sqlite> select * from create_index.sqlite_master;
>

As far as I know, there is no such command as 'use <database>'. You
can shorten your db prefix to a single letter, and save typing, if
that bothers you

ATTACH DATABASE 'very_long_name_of_my_external_db_file.sqlite' AS v;
SELECT * FROM v.table;

In my personal view, always fully qualifying your source table and
columns is very good practice as it eliminates any ambiguity.


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



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to