Operators
Logical Operators
Operators | Description |
---|---|
| allows you to perform operations similar to using WHERE and |
| allows you to perform operations similar to using WHERE and |
| used with |
| allow you to combine operations where all combined conditions must be true. |
| allows you to combine operations where at least one of the combined conditions must be true. |
Set Operators
Operators | Description |
---|---|
| combines and returns the result-set retrieved by two or more SELECT statements. |
| removes the duplicates from the results of the second SELECT query from the results of the first SELECT query and then returns the filtered result from the first query. |
| combines the result fetched by the two SELECT statements where records from one match the other and then returns this intersection of result-sets. |
Before any of the above operations are performed the following conditions should be followed
Each SELECT statement must have the same number of columns
The columns must also have the similar data types
The columns in each SELECT statement should be in the same order
UNION
operation removes duplicates from the final result, whereas UNION ALL
operation does not remove duplicates and displays all the data.
NULL
are different than a zero - they are cells where data does not exist. When identifying NULLs in a WHERE
clause, we write IS NULL
or IS NOT NULL
. We don't use =
, because NULL
isn't considered a value in SQL. Rather, it is a property of the data.
Last updated