临时表分为两种,它们只在事务或者会话内有效。
------------------------------------
A. 事务临时表(缺省):
CREATE GLOBAL TEMPORARY TABLE table_name(col_name INT);
CREATE GLOBAL TEMPORARY TABLE table_name(col_name INT) ON COMMIT DELETE ROWS;
------------------------------------
B. 会话临时表:
CREATE GLOBAL TEMPORARY TABLE table_name(col_name INT) ON COMMIT PRESERVE ROWS;