Export from emp table to emp file:-
postgres=# copy emp from '/tmp/emp.txt';
COPY 2
postgres=#
postgres=#
postgres=#
postgres=# select * from emp;
no | ename
----+-------
1 | Samik
2 | Amit
1 | Samik
2 | Amit
(4 rows)
postgres=#
postgres=#
postgres=# \q
postgres=#
postgres=# \q
-bash-4.2$
-bash-4.2$
-bash-4.2$ rm -rf /tmp/emp.txt
-bash-4.2$
-bash-4.2$
-bash-4.2$ psql -p 5455
psql (10.9, server 15.5)
WARNING: psql major version 10, server major version 15.
Some psql features might not work.
Type "help" for help.
Import from emp.txt file to emp table:-
postgres=# copy emp to '/tmp/emp.txt' with delimiter '|';
COPY 4
postgres=#
postgres=#
postgres=# \q
-bash-4.2$
-bash-4.2$
-bash-4.2$ cat /tmp/emp.txt
1|Samik
2|Amit
1|Samik
2|Amit
-bash-4.2$
-bash-4.2$
No comments:
Post a Comment