SQL SQlite:选择进去?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2027488/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQlite: select into?
提问by Glaucon
I'm not sure if I can use select into to import data from another table like this:
我不确定是否可以使用 select into 从另一个表中导入数据,如下所示:
select * into
bookmark1
from bookmark;
Is it true that SQlite doesn't support this syntax? are there any other alternatives?
SQlite 真的不支持这种语法吗?还有其他选择吗?
采纳答案by Nick Dandoulakis
You can try this query:
你可以试试这个查询:
insert into bookmark1 select * from bookmark
回答by vit
You could do:
你可以这样做:
create table bookmark1 as select * from bookmark;
回答by neo
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.
我假设 bookmark1 是您创建的与书签表相同的新表。在这种情况下,您可以使用以下格式。
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
或者您也可以使用带有子查询的插入语句。对于不同的插入语句选项,请参阅:SQL As Understood By SQLite
回答by Wadood Chaudhary
create table NewTable as
select * from OldTable where 1 <> 1
This will copy data structure for you.
这将为您复制数据结构。