ubuntu postgresql 14.04 使用教程

 时间:2026-02-13 00:38:19

1、打开终端窗口。

输入sudo su postgres

然后psql,这样就进入postgres了。

ubuntu postgresql 14.04 使用教程

ubuntu postgresql 14.04 使用教程

ubuntu postgresql 14.04 使用教程

2、输入help可以有些帮助指令。

ubuntu postgresql 14.04 使用教程

3、输入\l可以查看当前存在的数据库。

ubuntu postgresql 14.04 使用教程

ubuntu postgresql 14.04 使用教程

4、CREATE DATABASE 名字;

这样可以创建数据库。

ubuntu postgresql 14.04 使用教程

ubuntu postgresql 14.04 使用教程

5、\c 数据库名字;

这样可以连接到创建的数据库。

ubuntu postgresql 14.04 使用教程

6、CREATE TABLE 名字(

id INT,

name VARCHAR(50)

);

这样可以创建表格。

ubuntu postgresql 14.04 使用教程

7、\d可以查看创建的表格。

ubuntu postgresql 14.04 使用教程

8、DROP TABLE 名字;

这个指令可以删除表格。

ubuntu postgresql 14.04 使用教程

9、INSERT INTO 名字(id, name)

VALUES();

现在可以这样插入数据。

ubuntu postgresql 14.04 使用教程

10、SELECT * FROM 名字;

这样可以读取表格数据。

ubuntu postgresql 14.04 使用教程

11、UPDATE 名字 SET name='alice' WHERE id=88;

这里是更新已经存在的表格信息。

ubuntu postgresql 14.04 使用教程

  • 薄膜片材晕墨掉墨油墨附着力差等问题及解决办法
  • DELL R420服务器
  • 辅导孩子学习普通话的轻声和儿化
  • 怎么选择好的SSD固态硬盘?看品牌、颗粒、主控
  • 老烂腿用什么药好
  • 热门搜索
    微信发朋友圈不带图片怎么发 花生衣怎么吃补血小板 铅笔英语怎么读 花呗怎么开通 超载怎么处罚 电脑自动休眠怎么取消 宝贝不大怎么让你舒服 书怎么画 怎么生成目录 怎么恢复眼睛