Share
Explore BrainMass

isbns from two different tables

I have a query that starts with the line:

SELECT books.isbn, order_lines.isbn

...why would I want to see isbns from two different tables? What sort of query would warrant that - an inner join or an outer join?

Assume the table "books" contains books that the company stocks. Assume the table order_lines only contains books that have actually been ordered.

Solution Preview

1) You want to use inner join on tables 'books' and 'order_lines'
when you want to get all records from both of tables 'books' and 'order_lines'
where there is a match i.e having same ISBN. If there are rows in 'books' that do not have matches in 'order_lines', those rows (BOOKS records) will not be listed.
So innerjoin will give all the books records that are in both tables 'books' and 'order_lines'
So with the assumption the table "books" contains books that the company stocks. Assume the table order_lines only contains books that have actually been ordered.
the innerjoin query results displaying companystocks books that have been ...

Solution Summary

The expert examines isbns from two different tables. The sort of query which would be warranted are determined.

$2.19