Download Informix Guide to SQL: Tutorial, Version 6.0

Transcript
Single-Table SELECT Statements
can search for occurrences of a percent sign (%) in the res_descr column with
the LIKE wildcard %. The query retrieves the row shown in Query Result 2-35:
customer_num
call_dtime
user_id
call_code
call_descr
res_dtime
res_descr
116
1992-12-21 11:24
mannyn
I
Second complaint from this customer! Received
two cases right-handed outfielder gloves
(1 HRO) instead of one case lefties.
1992-12-27 08:19
Memo to shipping (Ava Brown) to send case of
left-handed gloves, pick up wrong case; memo
to billing requesting 5% discount to placate
customer due to second offense and lateness
of resolution because of holiday
Query Result 2-35
Using Subscripting in a WHERE Clause
You can use subscripting in the WHERE clause of a SELECT statement to specify
a range of characters or numbers in a column, as shown in Query 2-36:
SELECT catalog_num, stock_num, manu_code, cat_advert,
cat_descr
FROM catalog
WHERE cat_advert[1,4] = 'High'
Query 2-36
The subscript [1,4] causes Query 2-36 to retrieve all rows in which the first
four letters of the cat_advert column are High, as shown in Query Result
2-36:
2-44 Composing Simple SELECT Statements