【PostgreSQL 17】2 使用pgAdmin初始化示例表

启动pgAdmin

从开始菜单启动 pgAdmin
image

这里默认有一个连接,点击后会让我们设置密码
image

新建连接

Servers → Register → Server
image

General

因为在数据库服务器就在本地,Name就设为localhost
image

Connection

image

新建数据库

image

image
可以在SQL界面看到对应的SQL语句
image
创建好后这里就能看到
image

设置连接

断开连接
image

更改配置
image

默认连接到我们刚新建的数据库
image

查询工具 Query Tool

打开查询工具
image

查询数据库版本
image

从教程的github中下载脚本,放到安装目录的scripts文件夹下
下载地址位于文末参考资料中。
image

运行01_create_table.sql,新建了3张表和1个视图
image

运行02_insert_data.sql,插入一些数据。查看前100行
image
image

运行03_create_index.sql创建索引
image

参考资料

[1] dongxuyang1985/postgresql_dev_guide
[2] 不剪发的Tony老师

posted @ 2025-08-05 10:39  苦涩如影相随固  阅读(67)  评论(0)    收藏  举报