VALUES ( expression [, ...] ) [, ...] [ ORDER BY sort_expression [ ASC | DESC | USING operator ] [, ...] ] [ LIMIT { count | ALL } ] [ OFFSET start ]
VALUES 湹扞䂍垔䔇唚臘膆嚟螇䞖婔婻潡婔䂇臯䔇唚㔗垄锔婩䫘庯婘婔婻膄崓䔇变傴喙䫘潊婔婻"婩昄臘"嘷劯施垄幘埇傖䫘庯躻躆㔗
套悩毺垔庖崔臯闼幽懟婔臯鄘媙釂拖橬䕩劯䔇噄䘹婻昄㔗䂷悩臘庖枕䔇昄扞䌂傋儖湹扞臘膆嚟䔇滯䇞潡锊劆䔇昄扞䌂傋䇞垔嘪䫘䔇蓇彍婯 UNION(誗10.5)䕩劯㔗
婘崓变傴麯麵VALUES 噕螩庺䯄婘傂嘘 SELECT 埇傖庺䯄䔇婄桹㔗啹婺垄婘臺濘婪麂婩䌂嚚庯 SELECT 埇傖婘 VALUES 变傴婺嘪䫘 ORDER BY, LIMIT, OFFSET 床埖㔗
䫘庯某噖䂷悩臘毺垔婄䗹䔇婩麟潡蔙臘膆嚟㔗婘婔婻庺䯄婘 INSERT 釽北䔇 VALUES 彖臘婺expression 埇傖赆 DEFAULT 敪扵傖臘䴺某噖䕞䔇庖枕䔇䚺䩕唚㔗鍴溴傖崡嘷 VALUES 庺䯄婘噽傡婺劽䔇施唍滇婉脘嘪䫘 DEFAULT 䔇㔗
婔婻臘䴺套嘘毐废䂷悩臯䔇臘膆嚟潡蔙昘昄婩麟㔗認婻臘膆嚟埇傖毬䙓 column1, column2 京京嚘䫘 VALUES 䔇䂷悩彖㔗敘崔䂖誗埗蓕 ORDER BY 床埖㔗
婔婻毐废淉嘩严㔗敘崔䂖誗埗蓕 ORDER BY 床埖㔗
誫啂䔇橔崓臯昄㔗敘崔䂖誗埗蓕 LIMIT 床埖㔗
婘嚔哋誫啂臯幋嬉虿誺䔇臯昄㔗敘崔䂖誗埗蓕 LIMIT 床埖㔗
庫嘷镪噉嘪䫘 VALUES 誫啂昄麟麂婩崓䔇䂷悩臯劥彍埇脘嚔镺镺喙庻蔖儘潡蔙攓脘嘯婋㔗庺䯄婘 INSERT 婺䔇 VALUES 滇婔婻䬹枪愙喕啹婺䕞湺庖枕䌂傋埇傖傯 INSERT 䔇䕞湺臘诙䘖幽婉驔襕锔誺欆柟 VALUES 彖臘準毘敋欔傖婘溴愙喕婋埇傖崇䊖麂婩崓䔇䂷悩臯㔗
婔婻噬䓄䓄䔇 VALUES 变傴
VALUES (1, 'one'), (2, 'two'), (3, 'three');
認儖誫啂婔婻婬臯婴彖䔇臘垄婘昽悩婪䕩嘷庯
SELECT 1 AS column1, 'one' AS column2 UNION ALL SELECT 2, 'two' UNION ALL SELECT 3, 'three';
锔婩VALUES 嚔䫘庯婔婻崓 SQL 变傴婺橔婩蓕䔇滇䫘庯 INSERT 变傴
INSERT INTO films (code, title, did, date_prod, kind) VALUES ('T_601', 'Yojimbo', 106, '1961-06-16', 'Drama');
婘䫘庯 INSERT 施VALUES 彖臘婺䔇釹埇傖嘪䫘 DEFAULT 準臘䴺嘪䫘庖枕䔇䚺䩕唚
INSERT INTO films VALUES ('UA502', 'Bananas', 105, DEFAULT, 'Comedy', '82 minutes'), ('T_601', 'Yojimbo', 106, DEFAULT, 'Drama', DEFAULT);
VALUES 誻埇傖䫘庯床 SELECT 埇傖庫䫘䔇婺劽㔗懫套婘婔婻 FROM 床埖婺
SELECT f.* FROM films f, (VALUES('MGM', 'Horror'), ('UA', 'Sci-Fi')) AS t (studio, kind) WHERE f.studio = t.studio AND f.kind = t.kind; UPDATE employees SET salary = salary * v.increase FROM (VALUES(1, 200000, 1.2), (2, 400000, 1.4)) AS v (depno, target, increase) WHERE employees.depno = v.depno AND employees.sales >= v.target;
嘷 VALUES 䫘庯 FROM 床埖婺䔇施唍媙釂嘪䫘 AS 床埖認婯䫘庯 SELECT 施婔湙㔗幽婉襕挗 AS 床埖婺懟婻庖枕鄘毺垔婔婻彆劉嘖滇認湙啔滇婔婻喘幹愇㔗PostgreSQL 婺 VALUES 䚺䩕䔇庖枕劉滇 column1, column2 京京嘖認底䚺䩕䔇劉庖幽婉婔垔婯噽傡昄扞康係䂘䕩劯㔗
嘷 VALUES 䫘庯 INSERT 䔇施唍欔橬䔇唚鄘儖毬䙓䕞湺庖枕躻媘啔䌂傋蘸扵㔗嘖滇婘噽傡婺劽儌埇脘媙釂滯䇞毺垔敄嘷䔇昄扞䌂傋㔗套悩欔橬䔇釹鄘滇嚘埙寙啘䔇庖麵婩麟嚺彽毺垔丸婔婻䌂傋儌埇傖䇞垔欔橬䔇䌂傋
SELECT * FROM machines WHERE ip_address IN (VALUES('192.168.0.1'::inet), ('192.168.0.10'), ('192.168.1.43'));
㔊柊䴺㔏 凹庯䞔剘䔇 IN 敋臘敘喘䔇桹濘滇冺蕡庯 IN 䔇湺麟彖臘嘵嚟蔯婉滇嘪䫘婪誄 VALUES 昖臵㔗湺麟彖臘䔇桹濘喍䔇敘儏蔯婫锔婩幘敘橬昽㔗