Answer the question
In order to leave comments, you need to log in
How to write a query correctly - All values where the name column is not empty and discount contains VIP?
Hello everyone, help me write such a query to the database correctly,
select the client table and show all the rows in it with the condition that the name is not empty and the discount contains the word VIP
, I have such a table client
id | name | phone | birthdate | discount | visits
1 | Ivan | 077112233 | 01/01/2015 | VIP-0001 | 0
Here is my query SELECT * FROM `client` WHERE name IS NULL and discount LIKE '%VIP%' but it displays all 1000 rows for me, and should display only those whose name is filled in, which means the card was issued to the client
Answer the question
In order to leave comments, you need to log in
Decision!
SELECT * FROM `client` WHERE name NOT LIKE '' and discount LIKE '%VIP%'
In your request it is written that name is just empty. Must be name is not null
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question