我正在尝试为少于10个关注者和超过1000个关注者的用户删除所有数据。到目前为止我收到了这个问题:
DELETE FROM Test
WHERE Followers
BETWEEN 1 AND 9
此查询删除10个粉丝以下的用户的数据。如何删除超过1000个粉丝的用户?我可以同时拥有两个查询。
答案 0 :(得分:7)
问题在于你没有DELETE *
这意味着你必须从一行告诉它DELETE
的哪些列。您但是正在删除整行,因此不必指定*
DELETE FROM Test
WHERE (Followers >=1
AND Followers <10)
OR Followers >1000
答案 1 :(得分:4)
试试这个:
由于Followers
字段仅包含&gt; 0:
DELETE FROM Test
WHERE Followers <10
OR Followers >1000
答案 2 :(得分:2)
使用OR
DELETE
FROM Test
WHERE Followers BETWEEN 1 AND 9
OR Followers > 1000;
答案 3 :(得分:2)
只需将条件与OR
子句结合起来:
DELETE
FROM Test
WHERE Followers BETWEEN 1 AND 9
OR Followers >1000