Hi everyone, after spending a lot of time searching for a solution, I'm still having a problem in one of my exercises.
This is what I have been asked to do:
*List name, type, price and description for all juices that include the word fruit but not fruits or fruit as part of another word (e.g. grapefruit).
This is the query I'm using:
Code:
SELECT juice_id, juice_name, juice_type, juice_price, juice_description
FROM tblJuice
WHERE juice_description LIKE '%fruit%'
AND juice_description NOT LIKE '%fruits%';
I cannot figure out how to not include fruit as part of another word (and I have been trying multiple combination but in vane.
Can anyone shed some light?
Thanks in advance.
xls file
juiceData.xls
http://img194.imageshack.us/img194/6066/capturedgl.png
Could anyone load this table and post the query? It will help me a lot.
Considering that the lesson for LIKE operator is:
Code:
1) Uses wildcards to test for pattern match
2) % represents any collection of characters
3) _ (underscore) represents any single character
Note searches using wildcards can be slow to process
and the examples are:
Code:
List name and description of all juices where description includes ‘orange’
e.g.1
SELECT juice_name, juice_description
FROM Juice
WHERE juice_description LIKE '%orange%‘
e.g. 2
WHERE name LIKE ‘T_m’ would return ‘Tim’, ‘Tom’ etc.
I believe I have to work out the solution by using only the syntax in the LIKE Operator from the code above.
Many thanks
S969