SQL Like not showing results
Clash Royale CLAN TAG#URR8PPP
SQL Like not showing results
Simple Query not working for some reason,
I have a simple table with EmpName and Contact
My SQL code is
SELECT EmpName, ContactNumber
FROM Employee
WHERE EmpName Like '%Carpenter%';
i can't figure out why it isn't working, Image of table below
WHERE
@taha SQL identifiers and reserved words are not case sensitive
– Tyler Roper
Aug 12 at 4:55
Can you clarify how it's not working? Is it returning an empty set, or something else?
– John Stark
Aug 12 at 4:58
Can you provide sample data n script?
– Prashant Pimpale
Aug 12 at 5:14
Please do not insert screenshots because it it hard to copy their shown data for test cases. Please provide an insert statement, a text table or a sql fiddle.
– S-Man
Aug 12 at 6:57
1 Answer
1
I suspect this is MS Access, not Amazon Redishift. Therefore you need to use *
as the wildcard, not %
*
%
SELECT EmpName, ContactNumber
FROM Employee
WHERE EmpName Like '*Carpenter*';
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
1. Please edit your question to tag your RDBMS (MySQL, Sql-Server, etc) 2. Don't see anything in your question that explains the behavior. Can you ensure that if you eliminate the
WHERE
clause entirely, your result set includes the record you're expecting?– Tyler Roper
Aug 12 at 4:51