删除数据

来源:互联网 发布:中国省份数据库 编辑:程序博客网 时间:2024/06/04 01:11

delete 【form 】【schema.】表名【where condition】
schema.:用户模式 例如 zhou.student
condition:删除添加/表达式/字句

删除案列1
这里写图片描述

删除案列2

create table class(
cno varchar2(10) primary key,
cname varchar2(20),
cnum number(2)
);

create table student2(
sno varchar2(10) primary key,
sname varchar2(20),
sage number(2),
cno varchar2(2),
constraint fk_sno foreign key(cno) references class(cno) on delete cascade
);

insert into student2 values(‘2’,’lili’,18,’1’);
insert into student2 values(‘3’,’lili’,18,’1’);
insert into student2 values(‘4’,’lili’,20,’1’);
insert into student2 values(‘5’,’lili’,21,’1’);

delete from student2 where sname=’lili’

这里写图片描述

0 0