Home > Blockchain >  How to view a temporary table?
How to view a temporary table?

Time:09-23

I am using SQLite Studio. When I create a table I can see and add data to it. I cannot see a temporary table. My code:

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'
    );

How can I access and see the data of Books2?

CodePudding user response:

The temporary table that you create is stored in a different database named temp which is also temporary and will be deleted when the current connection will be closed.
The contents of this temporary database are not visible (as far as I know) in SQLite Studio.

To access the temporary table use an ordinary query and to avoid naming conflicts use the prefix temp before the table's name:

SELECT * FROM temp.Books2;

The prefix main can be used for the names of the tables of the current database, if needed.

  • Related