前沿拓展:
delete語(yǔ)句
DELETE 語(yǔ)句DELETE 語(yǔ)句用于刪除表中的行。語(yǔ)法DELETE FROM 表名稱 WHERE 列名稱
如果需要在delete的時(shí)候,按照條件刪除記錄,那么可能會(huì)用到子查詢。
但是如下情況:
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 子句中的結(jié)果集起別名。
delete from student where id = (select n.max_id from (select max(id) as max_id from student) as n);
這個(gè)方法對(duì)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)
參考資料來(lái)源:百度百科-DELETE語(yǔ)句
delete語(yǔ)句
DELETE 語(yǔ)句
DELETE 語(yǔ)句用于刪除表中的行。
語(yǔ)法
DELETE FROM 表名稱 WHERE 列名稱 = 值
刪除某行
"Fred Wilson" 會(huì)被刪除:
DELETE FROM Person WHERE LastName = 'Wilson'
刪除所有行
可以在不刪除表的情況下刪除所有的行。這意味著表的結(jié)構(gòu)、屬性和索引都是完整的:
DELETE FROM table_name
或者:
DELETE * FROM table_name
本回答被網(wǎng)友采納
delete語(yǔ)句
delete (字段名)from 數(shù)據(jù)表 where 字句
例如:delete from 學(xué)生表 where 學(xué)號(hào)='123456'
本回答被提問(wèn)者采納
delete語(yǔ)句
delete XXXX表 where XXX=XXX
原創(chuàng)文章,作者:九賢生活小編,如若轉(zhuǎn)載,請(qǐng)注明出處:http://m.xiesong.cn/7016.html