2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

How to delete specific rows in a sql table

I want to know how can I delete multiple rows  at a time .

 I want to delete CategoryID 2,3,5.

I tried like below

DELETE FROM Categories

WHERE CategoryID="2"AND CategoryID="3" AND CategoryID="5";

but no rows and deleted. And if I use OR then everything gets deleted.

Table name Categories

 CategoryID   CategoryName         

   1           Beverages        

   2           Condiments       

   3           Confections      

   4           Dairy Products   

   5           Grains/Cereals   

   6           Meat/Poultry 

userimage

DELETE FROM Categories WHERE CategoryID IN (2, 3, 5);

 

Answer is