1.7

# IS NULL, BETWEEN, IN Operators

### 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, IndepYearFROM countryWHERE 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, IndepYearFROM countryWHERE 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 nameFROM countryWHERE name IN ('Aruba', 'Barbados', 'Cuba', 'Bahamas')ORDER BY population ASC;

Results:

CC BY-NC-ND International 4.0: This work is released under a CC BY-NC-ND International 4.0 license, which means that you are free to do with it as you please as long as you (1) properly attribute it, (2) do not use it for commercial gain, and (3) do not create derivative works.

### End-of-Chapter Survey

: How would you rate the overall quality of this chapter?
1. Very Low Quality
2. Low Quality
3. Moderate Quality
4. High Quality
5. Very High Quality
Comments will be automatically submitted when you navigate away from the page.