发布网友 发布时间:2022-04-21 20:02
共6个回答
懂视网 时间:2022-05-03 19:27
delete语句怎么写?
DELETE 语句
DELETE 语句用于删除表中的行。
(免费学习视频教程推荐:mysql视频教程)
语法
DELETE FROM 表名称 WHERE 列名称 = 值
删除某行
"Fred Wilson" 会被删除:
DELETE FROM Person WHERE LastName = 'Wilson'
删除所有行
可以在不删除表的情况下删除所有的行。这意味着表的结构、属性和索引都是完整的:
DELETE FROM table_name
或者:
DELETE * FROM table_name
热心网友 时间:2022-05-03 16:52
语法:DELETE [table.*] FROM table WHERE criteria
说明:table参数用于指定从其中删除记录的表的名称。
criteria参数为一个表达式,用于指定哪些记录应该被删除的表达式。
可以使用 Execute 方法与一个 DROP 语句从数据库中放弃整个表。不过,若用这种方法删除表,将会失去表的结构。不同的是当使用 DELETE,只有数据会被删除;表的结构以及表的所有属性仍然保留,例如字段属性及索引。
扩展资料:
如果需要在delete的时候,按照条件删除记录,那么可能会用到子查询。
但是如下情况:
delete from student where id = (select max(id) from student);
[Err] 1093 - You can't specify target table 'student' for update in FROM clause
解决办法是:给 from 子句中的结果集起别名。
delete from student where id = (select n.max_id from (select max(id) as max_id from student) as n);
这个方法对in还是适用的
delete from student where id in (select id from student where id > 30);
[Err] 1093 - You can't specify target table 'student' for update in FROM clause
解决方法同上:
delete from student where id in (select n.id from (select id from student where id > 30) as n)
参考资料来源:百度百科-DELETE语句
热心网友 时间:2022-05-03 18:26
DELETE 语句
DELETE 语句用于删除表中的行。
语法
DELETE FROM 表名称 WHERE 列名称 = 值
删除某行
"Fred Wilson" 会被删除:
DELETE FROM Person WHERE LastName = 'Wilson'
删除所有行
可以在不删除表的情况下删除所有的行。这意味着表的结构、属性和索引都是完整的:
DELETE FROM table_name
或者:
DELETE * FROM table_name
热心网友 时间:2022-05-03 20:18
delete (字段名)from 数据表 where 字句
例如:delete from 学生表 where 学号='123456'
热心网友 时间:2022-05-03 22:26
delete XXXX表 where XXX=XXX
热心网友 时间:2022-05-04 00:50
1.
DELETE FROM Table1 WHERE ...(条件)
2.
DELETE a FROM Table1 a INNER JOIN Table2 b ON a.ID=b.ID WHERE ...(条件)