Home > Back-end >  how remove SQL where it can be compared with multiple columns
how remove SQL where it can be compared with multiple columns

Time:10-04

How can I delete data from a table in my database? For example, put a syntax where

delete from table_users where users or password or email or name = "perico"

CodePudding user response:

Here is a trick you can use with a tuple:

DELETE
FROM table_users
WHERE 'perico' IN (users, password, email, name);

Note: If you are actually storing plain text in your password column then you should stop and instead read about hashing and salting passwords. Clear text passwords in a database are a huge security risk.

CodePudding user response:

delete from table_users
where users = 'perico'
or password = 'perico'
or email = 'perico'
or name = 'perico'
  • Related