MySQL Query where id is not equal to (WHERE id <> 6)

User Avatar
👤 admin
🔴 Admin
✍️ The most important thing in the world is to not be alone.
⏳ Last active: 15 Apr 2025 at 16:01
📅 Created: 14 Feb 2021 at 20:03
👀 Viewed: 38 times
✉️ Send Email

Have you ever needed a query where you search for all except one thing?
Here is an example of a query where you search for all except the number 6:


SELECT user_id, username FROM users WHERE user_id &lt;> 6

If you have ten users with id from one to ten , number six won't be in the executed query.

If you want to comment: Login or Register