1.5 Retrieving data with search conditions specified
Specify search conditions (retrieval criteria) in the WHERE clause to narrow down the rows to be retrieved. The specification format of the WHERE clause is as follows.
Specification format
-
To specify only one search condition
SELECT "column-name" FROM "table-name" WHERE search-condition
-
To specify two or more search conditions
SELECT "column-name" FROM "table-name" WHERE search-condition-1 AND search-condition-2 ...
or
SELECT "column-name" FROM "table-name" WHERE search-condition-1 OR search-condition-2 ...
To specify multiple search conditions in the WHERE clause, connect them using AND or OR. You can specify a mix of ANDs and ORs.
- WHERE search-condition-1 AND search-condition-2:
-
Rows that satisfy both search-condition-1 and search-condition-2 will be retrieved.
- WHERE search-condition-1 OR search-condition-2:
-
Rows that satisfy either search-condition-1 or search-condition-2 will be retrieved.
- Note
-
For details about the syntax of WHERE clauses or search conditions, see the following.
-
WHERE clause: 7.6.1 Specification format for WHERE clauses
-
Search conditions: 7.18.1 Specification format and rules for search conditions
-