数据库如何实现删除功能?

来源:百度知道 编辑:UC知道 时间:2024/09/24 04:52:14
姓名 住址 学号 成绩
小刚 北京 4055 95
蒋介石 上海 4066 90

想把第二行删掉,怎么办?\

学号应该是没有重复的吧?那就这样:
delete from 这个表的名字 where 学号='4066';

如果里面所有数据都有可能重复的话,就这样:
delete from 这个表的名字 where 姓名='蒋介石' and 住址='上海'
and 学号='4066' and 成绩='90';

delete 表名 where 姓名=‘蒋介石’ and 住址=‘上海’ and 学号=4066 and成绩=90

delete 表名 where 学号=4066,

lianglei9810的解释是最准确的了,这样的方式一般用在已经知道各个字段的值。

但是最常用的是以下的这个方式:

delete 表 where 主键=某值;

delete from 表名 where 姓名='蒋介石'