sql創(chuàng)建臨時表語句 DB2怎么通過select語句創(chuàng)建臨時表?
DB2怎么通過select語句創(chuàng)建臨時表?其實是可以的,用物化查詢建表就可以:create table new_table_name as (select a.serv_number,b.user_i
DB2怎么通過select語句創(chuàng)建臨時表?
其實是可以的,用物化查詢建表就可以:
create table new_table_name as
(select a.serv_number,b.user_id
from table_name1 a,table_name2
where a.serv_number=b.serv_number)
data initially deferred refresh deferred
refresh table new_table_name
第一部分是建表結(jié)構(gòu),加上后面兩句就可以把數(shù)據(jù)刷新進去了,只不過有個條件就是:table_name1 和 table_name2都不能是像這樣物化查詢建出來的表
db2中如何創(chuàng)建臨時表?
不必用臨時表的
SELECT CASE A WHEN "a" THEN "yes" else "no" END
FROM table_name