The Language of SQL- P27:Research has shown that, being pressed for time, most readers tend to skip the introduction of any book they happen to read and then proceed immediately to the first real chapter. With that fact firmly in mind, we will only cover relatively unimportant material in the introduction, such as an explanation of what you will and will not learn by reading this book. | 116 Chapter 11 Combining Tables with an Inner Join The results are Cust ID First Name Last Name Order ID Qty Price 1 William Smith 1 4 2 Natalie Lopez 2 10 2 Natalie Lopez 3 12 3 Brenda Harper 4 5 Notice that we re using the AS keyword to specify both column and table aliases. It should also be mentioned that the AS keyword is completely optional. All of the AS keywords can be removed from the SELECT and the statement would still be valid and return the same results. However I recommend the use of the AS keyword for the sake of clarity. DATABASE DIFFERENCES Oracle As mentioned in Chapter 3 table aliases are specified in Oracle without the as keyword. The syntax for the statement in Oracle is SELECT AS Cust ID AS First Name AS Last Name Order ID AS Qty AS Price FROM Customers C INNER JOIN Orders O ON Looking Ahead The ability to join tables together in query is an essential feature of SQL. Relational databases would be of little use without joins. This chapter focused on the formulation of the inner join. The inner join brings back data for which there is a match between both tables being joined. We also talked about an alternate way of specifying the inner join and the usefulness of specifying table aliases. In our next chapter Combining Tables with an Outer Join we will turn to another important type of join the outer join. As mentioned inner joins only Looking Ahead 117 allow us to view data when there is a match between the tables being joined. So if you have a customer with no orders you won t see any customer information when doing an inner join between a Customers and an Orders table. The outer join will allow you to view customer information even if there are no orders for a customer. In other words the outer join lets us see data that we would not otherwise be able to obtain with an inner join. This page intentionally left .