-1

Screen shot

I have a table where it has some rows without any primary key or Id. How can I delete it by using multiple conditions in sql query?

Shadow
  • 33,525
  • 10
  • 51
  • 64
bunty
  • 1
  • 1
  • PK presence is not compulsory for the deletion. You must use WHERE condition(s) which completely identifies the row(s) to be deleted. – Akina Jul 26 '21 at 06:55
  • @Akina a pk per se is not necessary, just a combination of fields that are unique to the record(s) you want to delete. – Shadow Jul 26 '21 at 06:56

1 Answers1

0

https://www.w3schools.com/sql/sql_delete.asp Simply add all conditions needed to identify the item The best way to test the conditions it to try it first on a SELECT

DELETE FROM schedules WHERE COMPANYNAME = "TravelOnTip" AND AVAILABELSEATS = 50 AND FROMLOCATION = "BEN-SG";
Nico Bleiler
  • 475
  • 4
  • 14
  • Please do not refer to w3school in the questions which are tagged as MySQL-related - this site uses MS SQL syntax, so not all its statements are applicable to MySQL. Refer to MySQL Reference Manual. – Akina Jul 26 '21 at 06:59