postgres数据库入门, python 操作postgres

linux安装postgres参考: https://blog.csdn.net/luanpeng825485697/article/details/80875860

docker 安装postgres参考:https://blog.csdn.net/luanpeng825485697/article/details/81209596

postgres常用linux命令

进入pgsql命令行,切换到Linux用户postgres,然后执行psql:

$ su - postgres
Last login: Wed Mar 1 13:16:48 CST 2017 on pts/1
$ psql
psql (9.2.18)
Type "help" for help.
postgres=#

此时就在数据库postgres中了。

显示用户生成的数据库列表
\d
显示某个表列属性
\d tablename
查询数据
select camera_ip,camera_id from device;

创建数据库
CREATE DATABASE mydb;
删除数据库
DROP DATABASE mydb;
创建表
CREATE TABLE weather (
    city            varchar(80),
    temp_lo         int,           -- 最

你可能感兴趣的:(云原生/微服务架构/运维,系列课程,快速学习实战应用,大数据,系列课程,快速学习实战应用,postgresql,python,sql,数据库)