有没有办法在单个“CREATE TABLE AS”语句中设置PRIMARY KEY?
原文链接:https://www.f2er.com/postgresql/193065.html示例 – 我希望以下语句以1语句而不是2语句编写:
CREATE TABLE "new_table_name" AS SELECT a.uniquekey,a.some_value + b.some_value FROM "table_a" AS a,"table_b" AS b WHERE a.uniquekey=b.uniquekey; ALTER TABLE "new_table_name" ADD PRIMARY KEY (uniquekey);
有没有更好的方式这样做(假设有超过2个表,例如10)?