Operators Flashcards
INTERSECT
Combines two SELECT statements and returns only the dataset that is common in both the statements
EXCEPT
Returns the distinct rows that are present in the result set of the first query but not in the result set of the second query.
LIKE
The LIKE command is used in a WHERE clause to search for a specified pattern in a column.
You can use two wildcards with LIKE:
% - Represents zero, one, or multiple characters
_ - Represents a single character (MS Access uses a question mark (?) instead)
REGEXP
Used to search for a specified pattern using regular expression pattern matches.
UNION
Combines the data from the result of two or more SELECT statements into a single result set. This operator removes any duplicates present in the results being combined.
UNION ALL
Combines the data from the result of two or more SELECT statements into a single result set. This operator DOES NOT REMOVE any duplicates present in the results being combined.
IS NULL
Used to test for empty values (NULL values).
AND
Displays a record if all the conditions stated in the query are TRUE.
Example:
SELECT * FROM Customers
WHERE Country = ‘Germany’
AND City = ‘Berlin’
AND PostalCode > 12000;
This will display all Customers that are located in Berlin, Germany with a postal code 12000.
OR
Displays a record in which any of the conditions stated in the query are TRUE.
Example:
SELECT * FROM Customers
WHERE Country = ‘Germany’
OR City = ‘Berlin’
OR PostalCode > 12000;
This will display all Customers that are located in any city named Berlin (regardless of the country it’s in), customer in any city in Germany and customers that have their postal code as 12000.
=
Returns values that are “Equal To” the value input in the query
>
Returns values that are “Greater Than” the value input in the query
<
Returns values that are “Less Than” the value input in the query
> =
Returns values that are “Equal To or Greater Than” the value input in the query
<=
Returns values that are “Equal To or Less Than” the value input in the query
<>
Returns values that are “NOT Equal To” the value input in the query