On Tue, Mar 09, 2010 at 09:58:42PM +0000, Chris G wrote:
On Tue, Mar 09, 2010 at 09:51:55PM +0000, Jonathan McDowell wrote:
On Tue, Mar 09, 2010 at 09:46:31PM +0000, Chris G wrote:
It sounds like it should be easy but I can't see any reasonable way of doing it. How do you make a copy of a table in an sqlite3 database?
I can copy the database, that's trivial, but I want to duplicate a *table* within a database and that seems distinctly un-trivial.
INSERT INTO newtable SELECT * FROM oldtable;
assuming newtable and oldtable share the same schema?
I need to CREATE newtable first to be able to do that. Is there a similarly easy way to create newtable with the same schema as oldtable?
CREATE TABLE newtable AS SELECT * FROM oldtable; J. -- Web [ I forgot to account for the fact that my maths sucks. ] site: http:// [ ] Made by www.earth.li/~noodles/ [ ] HuggieTag 0.0.24