tags:

views:

450

answers:

3

I'm not sure if I can use select into to import data from another table like this:

select * into
  bookmark1 
from bookmark;    

Is it true that SQlite doesn't support this syntax? are there any other alternatives?

+4  A: 

You could do:

create table bookmark1 as select * from bookmark;
vit
sorry i can't give any point coz I'm new, but your suggestion works well.Thanks =)
Psycho
No problem, I'm not here for points. :)
vit
A: 

You can try this query:

insert into bookmark1 select * from bookmark
Nick D
This assumes bookmark1 already exists, while select into creates a new table.
vit
Your method may work but I need to create the table 'bookmark1' first. Otherwise it would be a syntax error X(thanks anyway.
Psycho
@vit, yes of course. It's for the case we want to import again in a table.
Nick D
@Nick: I'm sure you know this, I just thought this should be made clear for anyone why may stumble upon this question later. :)
vit
A: 

I assume that bookmark1 is a new table that you have created which is same as the bookmark table. In that case you can use the following format.

CREATE TABLE bookmark1 AS SELECT * FROM bookmark;

Or you can also use the insert statement with subquery. For different insert statement options refer: SQL As Understood By SQLite

Hope this helps.

Thnks.

rookie
That's helpful. Thanks=>
Psycho