PLSQL常用脚本2

来源:互联网 发布:如何做销售数据分析 编辑:程序博客网 时间:2024/05/16 08:13

建表

create table students(studentno number, studentname varchar2(20), classid number)

往表插入数据

insert into students(studentno ,studentname ,classid ) values(1, '张三', 1);
insert into students(studentno ,studentname,classid  ) values(2, '李四',2);
insert into students(studentno ,studentname,classid  ) values(3, '王五',3);


更新表一列

update students set classid=3 where studentno =3

删除表一列

delete from students where classid=3


在表增加一列

alter table students add classid varchar2(20)

修改表名

alter table students rename to students1

修改表一字段名

alter table students  rename column studentname to studentname1

修改表字段类型

alter table students modify studentname varchar2(30)

删除表一列

alter table students drop column  studentname