A WHERE statement can be used to filter data generated from a SELECT statement.
Syntax
SELECT [ ALL | DISTINCT ]
{ * | projectItem [, projectItem ]* }
FROM tableExpression
[ WHERE booleanExpression ];
The following table describes the operators can be used in a WHERE statement.
Operator | Description |
---|---|
= | Equal to |
<> | Not equal to |
> | Greater than |
>= | Greater than or equal to |
< | Smaller than |
<= | Smaller than or equal to |
Example
- Test data
Address City Oxford Street Beijing Fifth Avenue Beijing Changan Street Shanghai - Test statement
SELECT * FROM table_a WHERE City='Beijing'
- Test result
Address City Oxford Street Beijing Fifth Avenue Beijing