以下是对这个问题的回答:sqlite选择列名包含字符串的数据?我想知道如何用从上一个表中获得的这些新列创建一个表。我写了这样的东西(请忽略 WHERE 声明):
WHERE
CREATE TABLE new_tableAS(SELECT nameFROM pragma_table_info("old_table")WHERE name NOT LIKE '%\%%' ESCAPE '\'FROM old_table);
CREATE TABLE new_table
AS(
SELECT name
FROM pragma_table_info("old_table")
WHERE name NOT LIKE '%\%%' ESCAPE '\'
FROM old_table
);
然而,它不起作用。在此方面的任何帮助都将不胜感激。非常感谢
ugmeyewa1#
如果你想要 old_table 然后你可以这样做:
old_table
create table new_table asselect * from old_tablewhere 0;
create table new_table as
select * from old_table
where 0;
如果需要特定列,则必须在 select 列表:
select
create table new_table asselect col1, col2, ... from old_tablewhere 0;
select col1, col2, ... from old_table
1条答案
按热度按时间ugmeyewa1#
如果你想要
old_table
然后你可以这样做:如果需要特定列,则必须在
select
列表: