Skip to content
Advertisement

Searching for a string in a column

I need to show the results from this column where Product_name column contains ‘Documentation’ or ‘documentation’ in a result. The query must return a result regardless of whether the word is in lowercase or uppercase

https://i.stack.imgur.com/bjLuY.png

SELECT UPPER(PROD_NAME)as PROD_NAME, LENGTH(PROD_NAME) as PROD_NAME_LEN
FROM PRODUCTS 
WHERE (PROD_NAME like '%Documentation%'
 or PROD_NAME like '%DOCUMETATION%')
 and LENGTH(PROD_NAME) <= 35
    order by 2 DESC;

I found this solution, any suggestions

Advertisement

Answer

SELECT UPPER(PROD_NAME)as PROD_NAME, LENGTH(PROD_NAME) as PROD_NAME_LEN
FROM PRODUCTS 
WHERE lower(PROD_NAME) like '%documentation%'
 and LENGTH(PROD_NAME) <= 35
    order by 2 DESC;
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement