Filemaker Pro 9 (56) Flashcards
This set entered on 5-12-2014
5.2.14.3
- p 322. JOIN TABLES (CONT’D). Think of JOIN TABLES this way: INVOICES and PAYMENTS both have a ONE TO MANY RELATIONSHIP to the JOIN TABLE. So ONE INVOICE can connect to MANY JOIN RECORDS, each of which connects to ONE PAYMENT. Likewise, ONE PAYMENT can:
connect to MANY JOIN RECORDS, each of which connects to ONE INVOICE. So YOU GET MANY RELATED records in BOTH DIRECTIONS.
- A JOIN TABLE ALWAYS contains:
TWO FOREIGN KEYS, one from EACH TABLE it is JOINING.
- If your database has MANY TO MANY RELATIONSHIPS, you may have to create a JOIN TABLE to hold just THE TWO FOREIGN KEYS, unless:
your database already has a REAL TABLE that can act as a JOIN TABLE.
- What is an example of a REAL TABLE that can act as a JOIN TABLE?
Your database tracks ORDERS for the PRODUCTS YOU SELL. You have a PRODUCTS TABLE (PRIMARY KEY: PRODUCT SKU FIELD) and an ORDERS TABLE (PRIMARY KEY: ORDER NUMBER FIELD).
- The JOIN TABLE for the PRODUCTS-ORDERS MANY TO MANY RELATIONSHIP is the :
LINE ITEMS TABLE.
- The LINE ITEMS (JOIN TABLE) in the PRODUCTS-ORDERS MANY TO MANY RELATIONSHIP holds what fields?
it holds the PRODUCT SKU (FOREIGN KEY), the ORDER NUMBER (FOREIGN KEY), plus other quantitative fields, such as QUANTITY, PRICE, EXTENDED PRICE, etc.
- Other than being the JOIN TABLE with the FOREIGN FIELDS, the LINE ITEMS TABLE also shows:
a. Which PRODUCTS were on each order
b. How many
c. At what price.
- So the LINE ITEM TABLE not only serves as a JOIN TABLE, but it also:
holds the LINE ITEMS, which are REAL ENTITIES.
- So, how did you ELIMINATE the MANY TO MANY RELATIONSHIPS?
by CREATING JOIN TABLES, so that instead of a MANY TO MANY RELATIONSHIP, you have TWO ‘ONE TO MANY’ RELATIONSHIPS.