postgresql

1、postgresql的show databases、show tables、describe table操作
https://blog.csdn.net/u011402596/article/details/38510547

相当与mysql的describe table_name;
SELECT column_name FROM information_schema.columns WHERE table_name ='table_name';

2、# shell中使用带密码的方式直接pg_dump和psql
数据导入
psql "host=XX.XX.XX.XX port=5432 user=XXX password=XXX dbname=XXX" -f table_name.sql

3、oracle 的NVL(col,0)是判断如果col字段为空的时候赋值0。
postgresql里也有类似的方法

SELECT coalesce(collect_result,0) as collect_result
FROM collect

coalesce(mx.zhye,0)和nvl用法一致,若不为null,则显示原值,否则显示第二个字段。

4、将数据文件导入pg
psql "host=x.x.x.x port=xx user=xx password=xx dbname={database}" -c "\copy{table} from 'xx/xx/xx/xx.txt' delimiter '`'"

5、postgresql 删除、增加、修改字段(https://blog.csdn.net/weixin_41908066/article/details/111614266
https://www.cnblogs.com/chuyuan/p/14011200.html
alter table user_basic_info add column aaa numeric default 2;

6、pg连接数据库语句
psql "host=10.10.10.10 port=5432 user=postgres password=123456" -c "select * from abc;"

7、

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容