删除带有某字符的新闻的sql语句及步骤

 

注:为先确认删除范围,请先执行查询语句

1.查询news表中标题或新闻内容中带有’待查询字符’的新闻

select * from news where intactTitle like '%敏感词%'  or content like '%敏感词%'

3.删除news表中标题或新闻内容中带有’待查询字符’的新闻,如下(对多个敏感词进行批量操作):

delete from news where intactTitle like '%敏感词1%' or content like '%敏感词1%';

delete from news where intactTitle like '%敏感词2%' or content like '%敏感词2%';

delete from news where intactTitle like '%敏感词3%' or content like '%敏感词3%';

delete from news where intactTitle like '%敏感词4%' or content like '%敏感词4%';

delete from news where intactTitle like '%5%' or content like '%敏感词5%';