6
NULL的n行我有一个表,看起来像这样:产生的PostgreSQL
id, integer, Primary Key, not null
name, character varying
created, timestamp without timezone, not null, default: now()
我想生成NULL名称字段n行。
我知道我能做到:
INSERT INTO
employee (name)
VALUES
(NULL),
(NULL)...
但我更愿意做这样的事情:
INSERT INTO
employee (name)
SELECT
NULL
FROM
dummy_table_with_n_rows
而且我能够选择n个。
正是我在找的东西! –
@DanielPatz:不要错过功能的变化。有些非常整洁:http://www.postgresql.org/docs/9.2/static/functions-srf.html –