帮我写一下sqlite db的删除语句
'rating' table schema (rID, mID, rate, pub)
此查询将只返回一个元组
select * from rating
where rID = 101 and mID=678 and rate = 34.5 and pub='2012-11-03'
表格中的所有列都是非唯一的
这些查询不起作用
delete from rating where rID,mID, rate, pub in
(select * from rating where rID = 101 and mID=678 and rate = 34.5 and pub='2012-11-03')
delete from rating where rID=G.rID,mID=G.mID, rate=G.rate, pub=G.pub
(select * from rating where rID = 101 and mID=678 and rate = 34.5 and pub='2012-11-03') as G
答案 0 :(得分:1)
这有什么不对吗?
delete from rating
where rID = 101
and mID=678
and rate = 34.5
and pub='2012-11-03'
任何select语句都可以转换为delete语句,该语句会影响与select返回的行相同的行。实际上,这是测试哪些行将被删除的好方法。