Hi Shaun,

> It'd be extremely useful if I were able to alias a table as  
> "CurrentLanguage" as opposed to directly referencing the actual  
> name.  This saves me from having to tweak my lookup statements on  
> the fly to change the table name being accessed.  Is it possible to  
> perform such an alias?  I know that I could execute the line "CREATE  
> TABLE CurrentLanguage AS SELECT * from SomeLanguage" but will that  
> duplicate all the data or just reference the data?  I'd rather not  
> take the memory hit as these tables are quite
> large.  Suggestions?

You can simply create a view:

create view CurrentLanguage as select * from SomeLanguage;

That won't duplicate the data (create table as select etc would  
duplicate the data and would not update if the source table data  
changed). A view is just a reference to the original data.

If you are wanting to dynamically change the CurrentLanguage view in  
everyday ongoing use, then you probably shouldn't. It's not generally  
good to adjust the schema continually (ie drop and create a table or  
view etc). You'd be better to redesign your data so that it's all in  
one table, with the addition of a "Language" column. Then you can  
select the data you want for a particular language without adjusting  
your schema, such as:

select * from AllLanguages where Language = 'English';

or you could create a view, once, for each language, that refers to  
the one conglomerate table:

create view "English Language" as select * from AllLanguages where  
Language = 'English';

Tom
BareFeet

  --
Comparison of SQLite GUI applications:
http://www.tandb.com.au/sqlite/compare/?ml




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

Reply via email to