| Team Fly | |
101798 CT 15000
103171 CT 15000
102579 CT 15000
102238 CT 15000
101515 CT 15000
103007 UT 15000
104381 CT 15000
9 rows selected.
The like command exists within Oracle to search for records that match a pattern. The wildcard operator for pattern searches is the % sign. To search for all customers whose last name begins with the letter Q, the following query would produce these results:
SQL> select cust_last_name, cust_credit_limit 2 from customers 3 where cust_last_name like 'Q%'; CUST_LAST_NAME CUST_CREDIT_LIMIT ---------------------------------------- ----------------- Quinlan 9000 Quinn 11000
You could also ask Oracle to retrieve customers whose last names contain ''inl" by using the wildcard at the beginning and end of the pattern search. The query and output would resemble the following:
SQL> select cust_last_name 2 from customers 3 where cust_last_name like '%inl%'; CUST_LAST_NAME ---------------------------------------- Quinlan
As you can see from the preceding examples, Oracle has a very powerful set of operators when it comes to restricting the rows retrieved. Table 2-2 is a partial list of operators you can use in the where clause.
| Team Fly | |