我正在编写一个 SQL 脚本来将多个 .CSV 文件复制到 postgres 数据库中,如下所示:
COPY product(title, department) from 'ys.csv' CSV HEADER;
我有多个要复制的文件。我不想要:
COPY product(title, department) from 'ys1.csv' CSV HEADER;
COPY product(title, department) from 'ys2.csv' CSV HEADER;
COPY product(title, department) from 'ys3.csv' CSV HEADER;
COPY product(title, department) from 'ys4.csv' CSV HEADER;
COPY product(title, department) from 'ys5.csv' CSV HEADER;
我想为此使用 for 循环而不是多个复制命令。这可能吗?谢谢