Skip to content Skip to sidebar Skip to footer

How To Delete Multiple Rows With 2 Columns As Composite Primary Key In Mysql?

My innodb table has the following structure: 4 columns (CountryID, Year, %Change, Source), with the 2 columns (CountryID, Year) as the primary key. How do I delete multiple rows ot

Solution 1:

The answer in Oracle is:

deletefrom cpi
 where (countryid, year) in (('AD', 2010), ('AF', 2009), ('AG', 1992))

It's fairly standard SQL syntax and I think MySQL is the same.

Post a Comment for "How To Delete Multiple Rows With 2 Columns As Composite Primary Key In Mysql?"