Search code examples
sqloracleoracle11goracle-sqldeveloper

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.sstatic.net/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


Solution

  • 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;