How do I copy data from one table to another in postgres using copy command

前端 未结 3 631
情书的邮戳
情书的邮戳 2021-01-30 10:11

We use copy command to copy data of one table to a file outside database.

Is it possible to copy data of one table to another table using command.

If yes can anyon

3条回答
  •  旧巷少年郎
    2021-01-30 10:50

    Suppose there is already a table and you want to copy all records from this table to another table which is not currently present in the database then following query will do this task for you:

    SELECT * into public."NewTable" FROM public."ExistingTable";
    

提交回复
热议问题