postgresql的psql命令

1:不进入数据库而执行SQL命令,用参数-c

2:把SQL命令保存在一个外部文件中,用 -f 参数导入并执行

a1.txt文件内容

select * from student;

在shell中用如下命令

psql -d data1 -f a1.txt

3:显示所有数据库

psql -d data1 -l
原文地址:https://www.cnblogs.com/jmlovepython/p/4781384.html