logo

SQL: IN, NOT IN, BETWEEN, NOT BETWEEN, LIKE Operator

IN Operator

The IN operator allows us to specify multiple values in a WHERE clause. It enables us to easily test if an expression matches any value in a list of values. The IN operator is a shorthand for multiple OR conditions, making it useful for replacing many OR conditions.

SQL Example Table SQL IN operator

NOT IN Operator

The NOT IN operator is the opposite of the IN operator. It is used to exclude rows where the specified column matches any value in a list of values.

SQL NOT IN operator

BETWEEN Operator

The BETWEEN operator is used to select values within a given range (specified by minimum and maximum values). The values can be numbers, text, or dates. The BETWEEN operator is inclusive, meaning the begin and end values are included in the result.

NOT BETWEEN Operator

The NOT BETWEEN operator is the opposite of the BETWEEN operator. It is used to exclude values within a given range. Like the BETWEEN operator, it can be applied to numbers, text, or dates.

SQL NOT BETWEEN Operator

LIKE Operator

The LIKE operator is used in a WHERE clause to search for a specified pattern in a column. It matches string pattern values using two wildcard characters.

Wildcard Character: Used to substitute one or more characters in a string. There are two wildcards used in conjunction with the LIKE operator:

Percent Sign (%): Represents zero, one, or multiple characters.

Underscore (_): Represents only a single character.

The percent sign (%) and the underscore (_) can also be used in combinations.

SQL LIKE Operator

Examples:

Next ❯ ❮ Previous
discription of faastop website
logo