vendredi 24 octobre 2014

Difficulty Understanding Logic of Joines


Vote count:

0




I'll use the following query to illustrate my question:


select a.shipperid,



b.orderid,
b.custid


from shippers a inner join orders b


on a.shipperid = b.shipperid


Shipperid is the primary key in the shippers table, and it is also the foreign key in the orders table.

There are only three shipping IDs, and each of them is associated with many different orders in the order table. The join will match the tables when the shipper IDs match.


However, each of the shipper IDs in the shippers table is associated with many, many different rows in the orders table.


So, how do I know that the rows in the shippers table aren't being match with the rows in the orders table in an arbitrary manner?



asked 1 min ago







Difficulty Understanding Logic of Joines

Aucun commentaire:

Enregistrer un commentaire