linux 环境 postgresql 练习
su - postgres ---->切换用户:
postgres-# create user tank with password '6220104'; ---> 创建数据库用户:
postgres=# grant all privileges on *.* to " identified by "6220104" --->授权用户
create database tank with owner=tank template=template1 encoding='UNICODE'; ---> 创建数据库.并指定监时表空间
[postgres@web ~]$ psql -h 127.0.0.1 -U tank tank; --->本地连数据库,
tank=> \l --->查看数据库名
tank=> create table employee(
employee_id int primary key,
name char(8),
sex char(2));
tank=> \dt ----->查看数据库表名:
tank=>\d tablename --- >查看表结构.
tank=>create index IN_employee on employee(name); ---> 创建索引:
tank=>\di --->查看索引
tank=> drop index IN_employee ; 删除索引
tank=> drop table name ----> drop table;
tank=>drop database name --->drop databases;
阅读(2082) | 评论(0) | 转发(0) |