Home > Back-end >  SQL. DELETE Removal under several conditions (SQL. DELETE)
SQL. DELETE Removal under several conditions (SQL. DELETE)

Time:07-01

I have data base. I have to delete strings that meet several conditions: AND, OR Will delete people who were born from 2001-10-01 to 2010-10-01 and have names of the format XXXan or AnXXX, where X is an arbitrary symbol*

DELETE FROM people 
WHERE date> 2001-10-01 AND date < 2010-10-01 AND names LIKE ‘…an’ OR ‘An...’

But the second part of the request immediately applies AND to the first type of name, but I need the AND to select one of the two names.

CodePudding user response:

You have to use brackets to group the conditions.

DELETE FROM people 
WHERE date> 2001-10-01 AND date < 2010-10-01 AND (names LIKE ‘…an’ OR ‘An...’)
  • Related