--查看当前服务器数据库 SELECT datname FROM pg_database --查看创建的用户表 SELECT * FROM pg_stat_user_tables --创建一个数据库 CREATE DATABASE "fxsz_lt" WITH OWNER=postgres ENCODING='UTF8' TABLESPACE=pg_default --LC_COLLATE='Chinese (Simplified)_People''s Republic of China.936' --LC_CTYPE='Chinese (Simplified)_People''s Republic of China.936' CONNECTION LIMIT=-1; --删除数据库 DROP DATABASE litao_test --创建表空间 CREATE TABLESPACE "litao_test" OWNER postgres LOCATION '/var/lib/pgsql/9.3/data' --查询表空间 SELECT spcname FROM pg_tablespace --查询表空间所在的位置 SELECT spcname,pg_tablespace_location(oid)FROM pg_tablespace --删除表空间 DROP TABLESPACE products --创建表 CREATE TABLE UserInfo ( UserID varchar(50) NOT NULL, UserName varchar(50) NOT NULL, UserPwd varchar(50) ) --插入数据 INSERT INTO UserInfo VALUES('fxsz06046','litao','systemg'); --查询表数据 SELECT * FROM UserInfo