SQL Server temporary table
You can also create a temporary table. Temporary tables are similar to permanent tables, but temporary tables are stored in tempdb. They are automatically deleted when they are no longer used.
There are two types of temporary tables: local and global, both of which have different names, visibility, and availability. The name of the local temporary table starts with a single digit;
They are only visible to the current user connection; when the user is from Microsoft? SQL Server? 2000 the instance is deleted when it is disconnected. The name of the global temporary table is a mathematical symbol.
(##) After the table is created, it is visible to all users and deleted when all users that reference the table are disconnected from SQL Server.
For example, if you create a table named employees, anyone who has the security permission to use the table in the database can use the table unless it has been deleted.
If you create a local temporary table named # employees, you can only perform operations on the table and delete the table when the connection is disconnected. If you create a global temporary table named # employees
Any user in the data table can perform operations on the table. If the table is not used by other users after you create it, delete it when you disconnect it. If the table is created
Otherwise, SQL Server deletes the table after all users are disconnected.
Different:
1. the SQL Server temporary table is a "memory table", which is stored in the memory. The Oracle temporary table is stored in the data dictionary unless drop table is executed.
2. SQL Server temporary tables do not support transaction-level functions similar to Oracle temporary tables.
3. the SQL Server local temporary table (#) is similar to the Oracle session-level temporary table, but Oracle does not delete the table when the session exits.
4. SQL Server's global temporary table (#) means that multiple connections share the same piece of memory. When no pointer references the memory area, SQL Server Automatically releases the global temporary table.
5 because oracle is not a database in memory, if Oracle frequently creates and deletes temporary tables like SQL Server, it will definitely affect the performance.
Therefore, Oracle retains the definition of the temporary table until you drop the table.
6 in Oracle, if multiple users need to share a table (similar to SQL Server's global temporary table #), you can use permanent tables,
Add columns in the table that can uniquely identify the user. Use triggers and views. When the user exits, delete the data in the corresponding table based on the unique information of the login user.
This method brings a certain amount of load to Oracle.