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

前端 未结 3 685
情书的邮戳
情书的邮戳 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:32

    If the columns are the same (names and datatypes) in both tables then you can use the following

    INSERT INTO receivingtable (SELECT * FROM sourcetable WHERE column1='parameter' AND column2='anotherparameter');
    

提交回复
热议问题