Download Informix Guide to SQL: Tutorial

Transcript
Creating a Comparison Condition
Specifying A Range of Rows
Query 2-23 shows two ways to specify a range of rows in a WHERE clause.
Query 2-23
SELECT catalog_num, stock_num, manu_code, cat_advert
FROM catalog
WHERE catalog_num BETWEEN 10005 AND 10008
SELECT catalog_num, stock_num, manu_code, cat_advert
FROM catalog
WHERE catalog_num >= 10005 AND catalog_num <= 10008
Each statement in Query 2-23 specifies a range for catalog_num from 10005
through 10008, inclusive. The first statement uses keywords, and the second
statement uses relational operators to retrieve the rows as Query Result 2-23
shows.
catalog_num
stock_num
manu_code
cat_advert
10005
3
HSK
High-Technology Design Expands the Sweet Spot
catalog_num
stock_num
manu_code
cat_advert
10006
3
SHM
Durable Aluminum for High School and Collegiate Athletes
catalog_num
stock_num
manu_code
cat_advert
10007
4
HSK
Quality Pigskin with Joe Namath Signature
catalog_num
stock_num
manu_code
cat_advert
10008
4
HRO
Highest Quality Football for High School
and Collegiate Competitions
Query Result 2-23
Although the catalog table includes a column with the BYTE data type, that
column is not included in this SELECT statement because the output would
show only the words <BYTE value> by the column name. You can write an
SQL API application to display TEXT and BYTE values.
Composing SELECT Statements 2-29