PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔媆誕嬉誕

SELECT INTO

劉䓄

SELECT INTO -- 傯婔溇昖臵䔇䂷悩婺垔幬婔婻桄臘

臺濘

SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
    * | expression [ AS output_name ] [, ...]
    INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table
    [ FROM from_item [, ...] ]
    [ WHERE condition ]
    [ GROUP BY expression [, ...] ]
    [ HAVING condition [, ...] ]
    [ { UNION | INTERSECT | EXCEPT } [ ALL ] select ]
    [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
    [ LIMIT { count | ALL } ]
    [ OFFSET start ]
    [ FOR { UPDATE | SHARE } [ OF table_name [, ...] ] [ NOWAIT ] [...] ]

柟誄

SELECT INTO 傯婔婻昖臵䔇螇䞖䂷悩婺录傺婔婻桄臘㔗昄扞幽婉誫啂䂍垵潙䆇認婔䗹启捞锔䔇 SELECT 婉劯㔗桄臘䔇庖枕噙橬启 SELECT 䔇膷庺庖枕䕩劯䔇劉庖启昄扞䌂傋㔗

埗昄

TEMPORARYTEMP

套悩弄滯庖認婻噿髞庖闼幽臖臘滇嘩婺婔婻婘施臘录傺䔇㔗臙埗蔄 CREATE TABLE 诙埡䂖誗㔗

new_table

襕录傺䔇臘䔇劉庖(埇傖橬昇嚟媞閄)

欔橬噽垄膷噖䔇嘘鄘婘 SELECT 婺橬臥䂖柟誄㔗

濘懟

CREATE TABLE AS 䔇嘩䫘启 SELECT INTO 䌂嚚㔗傺螞嘪䫘 CREATE TABLE AS 臺濘啹婺 SELECT INTO 婉滇湺庖臺濘㔗垂鍙婪垄滇婉脘婘 ECPG 潡 PL/pgSQL 婺嘪䫘䔇啹婺垄傸凹 INTO 床埖䔇蓼麪滇婉劯䔇㔗蔯婫CREATE TABLE AS 柊冕庖 SELECT INTO 欔柊冕媘脘䔇轙镖㔗

婘 PostgreSQL 8.1 傖嬉 SELECT INTO 录傺䔇臘攂滇䚺䩕寙劆 OID 㔗彄庖 PostgreSQL 8.1 認婉喉滇䚺䩕庖襕愿婘桄臘婺寙劆 OID 埇傖欷嚔 default_with_oids 陉䘞埗昄潡嘪䫘 WITH OIDS 床埖㔗

冋床

录傺婔婻桄臘 films_recent 垄䔇唚寙劆準躻 films 䔇橔誏䔇溇䕞

SELECT * INTO films_recent FROM films WHERE date_prod >= '2002-01-01';

噚垹攓

SQL 湺庖䫘 SELECT INTO 臘䴺锬埡昄唚彄婔婻垪婂䘋废䔇湺麟埻麟婺蔯婉滇录傺婔婻桄臘㔗認䓉䫘濘垂鍙婪儌滇婘 ECPG(䆹31) 启 PL/pgSQL(䆹37)麯䔇䫘锫㔗PostgreSQL 䫘 SELECT INTO 录傺臘滇寖埾寘啹㔗婘桄傼乕麯橔喘嘪䫘 CREATE TABLE AS 垂䯄認婻䕞䔇㔗

埽蓕

CREATE TABLE AS

劯锔饡釕嬉誕
SELECT婪婔亓SET