启动:pg_ctl -D/XXX/data start 命令行登录数据库: psql -h hostip -u postrgres -d dbname -p port 列举数据库:l
切换数据库: cd \dbname
列举当前数据库的所有表:\d
查看指定表的所有字段:\d tablename
查看指定表的基本情况:\d+ tablename
退出操作:q
新建表: create table testcase( id integer, task_class integer, age text, primary key(id task_class) );
删除表: drop table test1;
清空表: delete table; or TRUNCATE TABLE [表名] 添加字段: Alter table [表名] add cloumn [字段名] [类型];
更改字段: alter table [表名] rename column [旧字段名] to [新字段名];
表中插入一行数据: insert into [表名] (字段1,字段2) values (值1,值2);