IS NULL
- Null values indicate an unknown or non-existent value and is different from an empty string (‘ ‘).
- To test for a null value you use the IS NULL clause
- The test for a value use IS NOT NULL clause
Example:
SELECT name, IndepYear
FROM country
WHERE IndepYear IS NULL;
Results:
BETWEEN Operators
- The BETWEEN operator is similar to >= and <=.
- BETWEEN includes everything between the two values indicated.
- BETWEEN works with both text and number.
Example:
USE world;
SELECT name, IndepYear
FROM country
WHERE name BETWEEN "Aruba" and "Bahamas";
Results:
The IN Keyword
- The IN clause tests whether an expression is equal to a value or values in a list of expressions.
- The order of the items in the list does not matter.
- You can use the NOT operator to test for items not in the list.
- The IN clause may be used with a subquery.
Examples:
USE world;
SELECT name
FROM country
WHERE name IN ('Aruba', 'Barbados', 'Cuba', 'Bahamas')
ORDER BY population ASC;
Results: