Contents

1 distinct on
2 Run external script in psql
3 link


1 distinct on #

--title覲 螳  customer_id fname 譟壱
select distinct on (title) title , customer_id, fname
from (select * from customer order by title, customer_id desc) t

2 Run external script in psql #

psql mydb < dump.sql
psql mydb -f dump.sql

psql -d mydb -f dump.sql

or

psql -f dump.sql mydb


psql [database name] < [script name]

testdb=# \i [script name]

3 link #