>>Previous>>
LIKE
Like is used with character and date data
SELECT column_name
FROM table_name
WHERE column_name [NOT] Like 'string'
1. %- String of zero or more characters
2. _ -Single Character
3. []- Single character within specified range
4. [^]- Single character not within specified range
Wildcard characters when used with Like keyword are enclosed in a single quotation mark
Example
SELECT title_id, title
FROM titles
WHERE title LIKE '%computers%'
OR
SELECT lname
FROM employee
WHERE lname like 'a%'
OR
SELECT lname
FROM employee
WHERE lname like '%a%'
OR
SELECT lname
FROM employee
WHERE lname like '%a'
OR
SELECT title_id, title
FROM titles
WHERE title LIKE '[cdefi]%'
Unknown Values
Null is equivalent to value "unknown"
IS NULL and IS NOT NULL operators are used
SELECT column_list
FROM table_list
WHERE column_name IS [NOT] NULL
Example
SELECT title_id, title
FROM titles
WHERE title_id IS NOT NULL
OR
SELECT title_id, title
FROM titles
WHERE title_id IS NULL