orcle增删改操作:操作前确保当前用户有增删改的权限。
--创建表 create table itcast( pid number(10), pname varchar2(10) ); drop table itcast; --复制表 create table product1 as select * from product; --表重命名 alter table product1 rename to product;
--插入数据 insert into itcast(pid,pname) values (2,'xxx'); commit; insert into itcast(pid,pname) values (1,'xxx'); commit;
--更新数据 update itcast set pid=3 where pname='xxx';
--删除数据 delete from itcast where pid=2;
--修改表 --增加字段 alter table itcast add(address varchar2(10)); --修改表字段 alter table itcast modify(address varchar2(20)); --删除表字段 alter table itcast drop column address; --字段重命名 alter table itcast rename column addres to address; --表重名 --alter table 表名 rename to 新表名
-- 删除表 --删除表中所有记录 delete from itcast; --删除表 drop table itcast; --删除表再创建表 truncate table itcast;