我会为您提供一些 PostgreSQL 中最常用的命令:
1. 创建数据库:CREATE DATABASE database_name;
2. 连接到数据库:\c database_name;
3. 创建表格:CREATE TABLE table_name (column1 datatype, column2 datatype, ...);
4. 插入数据:INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);
5. 查询数据:SELECT column1, column2, ... FROM table_name WHERE condition;
6. 更新数据:UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
7. 删除数据:DELETE FROM table_name WHERE condition;
8. 删除表格:DROP TABLE table_name;
9. 创建索引:CREATE INDEX index_name ON table_name (column1, column2, ...);
10. 备份数据库:pg_dump -U username -h host -d dbname > backup.sql;