INSERT INTO table [ ( column [, ...] ) ] { DEFAULT VALUES | VALUES ( expression [, ...] ) | SELECT query }
The name of an existing table.
The name of a column in table.
All columns will be filled by NULLs or by values specified when the table was created using DEFAULT clauses.
A valid expression or value to assign to column.
A valid query. Refer to the SELECT statement for a further description of valid arguments.
INSERT allows one to insert new rows into a table. One can insert a single row at a time or several rows as a result of a query. The columns in the target list may be listed in any order.
Each column not present in the target list will be inserted using a default value, either a declared DEFAULT value or NULL. Postgres will reject the new column if a NULL is inserted into a column declared NOT NULL.
If the expression for each column is not of the correct data type, automatic type coercion will be attempted.
You must have insert privilege to a table in order to append to it, as well as select privilege on any table specified in a WHERE clause.
Insert a single row into table films:
INSERT INTO films VALUES ('UA502','Bananas',105,'2025-08-08','Comedy',INTERVAL '82 minute');
In this second example the last column len is omitted and therefore it will have the default value of NULL:
INSERT INTO films (code, title, did, date_prod, kind) VALUES ('T_601', 'Yojimbo', 106, DATE '2025-08-08', 'Drama');
Insert a single row into table distributors; note that only column name is specified, so the omitted column did will be assigned its default value:
INSERT INTO distributors (name) VALUES ('British Lion');
Insert several rows into table films from table tmp:
INSERT INTO films SELECT * FROM tmp;
Insert into arrays (refer to the PostgreSQL User's Guide for further information about arrays):
-- Create an empty 3x3 gameboard for noughts-and-crosses -- (all of these queries create the same board attribute) INSERT INTO tictactoe (game, board[1:3][1:3]) VALUES (1,'{{"","",""},{},{"",""}}'); INSERT INTO tictactoe (game, board[3][3]) VALUES (2,'{}'); INSERT INTO tictactoe (game, board) VALUES (3,'{{,,},{,,},{,,}}');
INSERT is fully compatible with SQL92. Possible limitations in features of the query clause are documented for SELECT.
脑干诱发电位检查是检查什么 | 隋朝之前是什么朝代 | 肺肿了是什么病严重吗 | 分贝是什么意思 | 钾高吃什么药 |
立克次体病是什么意思 | 2023是什么年 | 区长是什么级别的干部 | 今天什么生肖冲什么生肖 | hi是什么 |
带翅膀的黑蚂蚁是什么 | 横店是什么 | 心脏是什么形状 | 梦见自己流血是什么预兆 | 幺蛾子是什么意思 |
碱中毒是什么引起的 | 整装是什么意思 | 娃娃鱼属于什么类动物 | 局座是什么梗 | 红花配绿叶是什么意思 |
为什么一生气就胃疼hcv9jop1ns4r.cn | 吃什么水果对心脏好tiangongnft.com | 氯仿是什么hcv9jop2ns2r.cn | 贫血应该吃什么hcv8jop6ns7r.cn | 订单号是什么hcv8jop3ns9r.cn |
气管炎吃什么药最有效hcv9jop6ns5r.cn | 一个火一个日一个立念什么hcv8jop5ns2r.cn | 一键挪车什么意思hcv7jop7ns3r.cn | cm和mm有什么区别beikeqingting.com | 什么叫tct检查hcv8jop6ns8r.cn |
体癣是什么原因引起的hcv7jop9ns7r.cn | 男生为什么会晨勃gysmod.com | 晚上八点到九点是什么时辰hcv9jop2ns8r.cn | 手心脚心出汗是什么原因hcv8jop0ns5r.cn | 炒菜什么时候放调料520myf.com |
peony是什么意思jiuxinfghf.com | 挂妇科门诊都检查什么hcv8jop7ns9r.cn | 不典型增生是什么意思hcv7jop7ns4r.cn | 换手率高说明什么hcv7jop6ns6r.cn | 微创手术是什么意思chuanglingweilai.com |