O'Reilly logo

Oracle Database 10g: A Beginner's Guide by Michael Corey, Michael Abbey, Ian Abramson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CRITICAL SKILL 2.5

Order Data

So far, all of our select queries have returned records in random order. Earlier, we selected records from the customer table where the customer was located in either Connecticut or Utah and had a credit limit of $15,000. The results came back in no apparent order. It is often desirable to order the result set on one or more of the selected columns. In this case, it probably would have been easier to interpret the results if they were sorted by state, and within that state were then sorted by customer ID. Let’s take a look at the query syntax and resulting output:

SQL> select cust_id, cust_state_province, cust_credit_limit 2 from customers 3 where cust_credit_limit = 15000 4 and cust_state_province in ('UT','CT') ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required