【问题标题】:How to view a temporary table?如何查看临时表?
【发布时间】:2022-09-23 04:57:31
【问题描述】:

我正在使用 SQLite Studio。当我创建一个表时,我可以看到并向它添加数据。我看不到暂时的桌子。我的代码:

create temporary table Books2
    (
    Title    varchar(32)    primary key,
    year     integer        not null,
    des      varchar(750)   null
    );

insert into Books2
values
    (
    \'CLRS\',
    \'2000\',
    \'A book in Algorithms\'
    );

如何访问和查看Books2 的数据?

    标签: sql sqlite sqlitestudio


    【解决方案1】:

    您创建的临时表存储在a different database named temp 中,这也是临时的,将在当前连接关闭时被删除。
    这个临时数据库的内容在 SQLite Studio 中是不可见的(据我所知)。

    要访问临时表,请使用普通查询并避免命名冲突,请在表名前使用前缀 temp

    SELECT * FROM temp.Books2;
    

    如果需要,前缀main 可用于当前数据库的表名。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-11
      • 2014-02-21
      • 2017-04-20
      • 2010-09-12
      • 2011-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多