USE QQMaster
--把QQ号码为54789625的用户黑名单中的用户删除。
DELETE FROM Relation WHERE QQID=54789625 AND RelationStatus=1
--QQ号码为622013019用户多次在QQ中发布违法信息,造成了很坏的影响,因此管理员决定将其删除。
----在关系表中删除用户622013019的信息
DELETE FROM Relation WHERE QQID=622013019 OR RelationQQID=622013019
-----在基本信息表中删除用户622013019的信息
DELETE FROM BaseInfo WHERE QQID=622013019
-----在用户表中删除用户622013019的信息
DELETE FROM QQUser WHERE QQID=622013019
--管理员将超过1000天没有登录过的QQ删除。
----查询超过1000天没有登录过的QQID集
SELECT QQID FROM QQUser WHERE DATEDIFF(DAY,LastLogTime,GETDATE())>=1000
----删除Relation表中的数据
DELETE FROM Relation
WHERE QQID IN(SELECT QQID FROM QQUser WHERE DATEDIFF(DAY,LastLogTime,GETDATE())>=1000)
OR RelationQQID IN(SELECT QQID FROM QQUser WHERE DATEDIFF(DAY,LastLogTime,GETDATE())>=1000)
----删除BaseInfo表中的数据
DELECT FROM BaseInfo WHERE QQID IN(SELECT QQID FROM QQUser WHERE DATEDIFF(DAY,LastLogTime,GETDATE())>=1000)
----删除QQUser表中的数据
DELETE FROM QQUser WHERE DATEDIFF(DAY,LastLogTime,GETDATE())>=1000
13 删除数据
最新推荐文章于 2023-02-13 15:37:36 发布