Scalable Database Server, HiRDB Version 8 Description
A search condition is specified to manipulate specific data in a table. A search condition is a condition for selecting rows. For example, a search condition can specify a specific range of data or all data that is not the null value. It is also possible to use Boolean operators to combine multiple conditions. The methods of searching for specific data and SQL specification examples follow.
The following methods can be used to search for data in a table:
The following three methods are available for searching for data within a specific range:
An example of using a comparison predicate for a data search is explained as follows.
SELECT PCODE,PNAME FROM STOCK WHERE SQUANTITY<=50
An example of conducting a search for rows in which there is a column that contains a specific character string is explained as follows.
SELECT PNAME,SQUANTITY FROM STOCK WHERE PCODE LIKE '_L%'
An example of conducting a search for rows in which a specified column does not contain the null value is explained as follows.
SELECT PCODE FROM STOCK WHERE PNAME IS NOT NULL
An example of conducting a search for rows that contain data that satisfies a combination of multiple conditions is explained as follows.
SELECT PCODE, SQUANTITY FROM STOCK WHERE (PNAME='blouse' OR PNAME='polo shirt') AND SQUANTITY=>50
You can code a complex query by specifying a retrieval result of a search as a condition in the SELECT statement. This is called a subquery. The following two subquery methods are available:
An example of conducting a search that uses a subquery that contains a quantified predicate is explained as follows:
SELECT PCODE,PNAME FROM STOCK WHERE SQUANTITY>ALL (SELECT SQUANTITY FROM STOCK WHERE PNAME='blouse')
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.