1. 索引
1.1 创建索引
create index index_name on table_name(column1, column2 ...);
1.2 删除索引
drop index index_name;
2. 视图
create view view_name as select ... from ... where ...;
3. 修改表
3.1 主键
alter table student add constraint stu_pk primary key (sno);
alter table student drop constraint stu_pk;
3.2 列是否可空
alter table student modify sname not null;
alter table student modify sname null;
3.3 唯一约束
alter table student add constraint stu_uk unique(sname);
alter tablestudent drop constraint stu_uk;
3.4 外键
create table sc (sno char(7), cno char(10), grade int, foreign key(sno) references student(sno));
4. 数据库用户管理
1. grant 系统权限 to {public|role|username} [with admin option]
网友评论