- 本机登录PostgreSQL:
psql -U posgtres -p 5432 -h localhost
or
psql - 显示数据库列表:
\l - 连接数据库:
\c "database_name" - 在数据库显示表的列表:
\dt
or
\dt+ - 显示表的列表数据:
SELECT * FROM "table_name"; - 命令行查询
psql -U postgres -d dbname -c "select * from tablename;"
参考
- https://www.cnblogs.com/ryanzheng/p/9575902.html
- https://tomcam.github.io/postgres/
本文介绍了如何通过PostgreSQL命令行工具进行登录、查看数据库列表、连接数据库、展示表信息及执行SQL查询的基本步骤,适合数据库初学者和开发者参考。

1239

被折叠的 条评论
为什么被折叠?



