Q&A

Q1:If the data within my table is already in sorted order, why should I use an index on that table?
A1: An index still gives you a performance benefit by looking quickly through key values in a tree. The index can locate records faster than a direct access search through each record within your database. Remember—the SQL query processor doesn't necessarily know that your data is in sorted order.
Q2:Can I create an index that contains fields from multiple tables?
A2: No, you cannot. However, Oracle, for instance, allows you to create a cluster. You can place tables within a cluster and create cluster indexes on fields that are common to the tables. This implementation is the exception, not the rule, so be sure to study your documentation on ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.