我正在尝试删除关注者少于 10 且关注者超过 1000 的用户的所有数据。到目前为止,我得到了这个查询:
DELETE FROM Test
WHERE Followers
BETWEEN 1 AND 9
此查询删除关注者不足 10 人的用户的数据。如何删除关注者超过 1000 人的用户?我可以将两个查询合二为一吗?
我正在尝试删除关注者少于 10 且关注者超过 1000 的用户的所有数据。到目前为止,我得到了这个查询:
DELETE FROM Test
WHERE Followers
BETWEEN 1 AND 9
此查询删除关注者不足 10 人的用户的数据。如何删除关注者超过 1000 人的用户?我可以将两个查询合二为一吗?
问题是你没有DELETE *
这意味着你必须告诉它哪一列DELETE
来自一行。但是,您正在删除整行,因此不必指定*
DELETE FROM Test
WHERE (Followers >=1
AND Followers <10)
OR Followers >1000
尝试这个:
由于Followers
字段仅包含 > 0 的值:
DELETE FROM Test
WHERE Followers <10
OR Followers >1000
Add this second condition to your query with OR
DELETE
FROM Test
WHERE Followers BETWEEN 1 AND 9
OR Followers > 1000;
Simply combine the conditions with an OR
clause:
DELETE
FROM Test
WHERE Followers BETWEEN 1 AND 9
OR Followers >1000