如何删除MYSQL表的的行
发布网友
发布时间:2022-04-24 05:45
我来回答
共3个回答
热心网友
时间:2022-04-07 16:14
DELETE FROM Course
WHERE c_id = 5 AND c_name = 'computer';
注意:既然你的表可以有2个c_id = 5 ,那个可能还有其他 c_id = 5 的记录,所以加上c_name = 'computer' 来保证是删除那两条记录。
语法:
Single-table syntax:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]
参考资料:http://arpoon.info/zh
热心网友
时间:2022-04-07 17:32
1、从MySQL数据表t1中把那些id值在数据表t2里有匹配的记录全删除掉
DELETE t1 FROM t1,t2 WHERE t1.id=t2.id 或DELETE FROM t1 USING t1,t2 WHERE t1.id=t2.id
2、从MySQL数据表t1里在数据表t2里没有匹配的记录查找出来并删除掉
DELETE t1 FROM t1 LEFT JOIN T2 ON t1.id=t2.id WHERE t2.id IS NULL 或
DELETE FROM t1,USING t1 LEFT JOIN T2 ON t1.id=t2.id WHERE t2.id IS NULL
3、从两个表中找出相同记录的数据并把两个表中的数据都删除掉
DELETE t1,t2 from t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t1.id=25
热心网友
时间:2022-04-07 19:23
delect from Course where c_id=5没有问题啊,你是不是设置为只读了啊。