Learn how to create SQL GLOBAL TEMORARY tables with syntax and examples.
SQL GLOBAL TEMPORARY TABLES are tables that are created distinct within SQL sessions.
The syntax for SQL CREATE GLOBAL TEMPORARY TABLE is:
CREATE GLOBAL TEMPORARY TABLE table_name ( column1 datatype null/not null, column2 datatype null/not null, ... );
table_name is the name of the global temporary table that you wish to create.
column1, column2 are the columns that you wish to create in the global temporary table. Each column must have a datatype. The column should either be defined as "null" or "not null" and if this value is left blank, the database assumes "null" as the default.
Let's look at a SQL CREATE GLOBAL TEMPORARY TABLE example:
CREATE GLOBAL TEMPORARY TABLE suppliers_temp ( supplier_id numeric(10) not null, supplier_name varchar2(50) not null, contact_name varchar2(50) );
This example would create a GLOBAL TEMPORARY TABLE called suppliers_temp.