Hitachi

Hitachi Advanced Database SQL Reference


1.8.2 Example 2: Retrieve customers whose name does not begin with M

Retrieve from the customer table (USERSLIST) the customer ID (USERID), name (NAME), and sex (SEX) of female customers whose name does not begin with M.

Table to search

[Figure]

Specification example
SELECT "USERID","NAME","SEX"
    FROM "USERSLIST"
        WHERE "NAME" NOT LIKE 'M%'
        AND "SEX"='F'
Retrieval results

[Figure]

Note

If NOT is specified, the search will return values that do not satisfy the conditional expression immediately following the NOT. If you specify NOT LIKE 'M%', as in the specification example above, the retrieval criteria will exclude character strings that begin with M.