It is possible to retrieve numerical values or dates from a table's columns, to perform operations on such values, and to extract the results. The data operation methods and an SQL specification example follow.
- Data operation methods
- The following methods can be used to perform data operations:
- Concatenation operations on character string data
- Arithmetic operations on numeric data
- Operations on date and time data
- Operations using scalar functions
- Specification of conditional values using the CASE expression
- Explicit type conversion using a CAST specification
- Data operation SQL specification example
- An example of performing an arithmetic operation on numeric data is explained as follows.
- Example
- In this example, the SELECT statement uses the price (PRICE) and stock quantity (SQUANTITY) to compute the projected revenue for products with sweat pants as the product name (PNAME) and extracts the product codes (PCODE) and the computation results (in units of $10):
SELECT PCODE,PRICE*SQUANTITY/10 FROM STOCK
WHERE PNAME='sweat pants'
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.