Software Engineering for Internet Applications

SQL Search

select * 
        from content
        where body like '%' || :user_query || '%'

--if the user is searching for running, it becomes
select * 
        from content
        where body like '%running%'


--to match upper and lower you do

select * 
        from content
        where upper(body) like upper('%running%')

--for multiple words we need to do 'and'

select * 
        from content
        where upper(body) like upper('%running%')
        and upper(body) like upper('%shoes%')


José M. Vidal .

28 of 30