|
Previous: A SEQUENCE Column
Next: Order Lines Part One
First Child TableNow it is time to add the "customer" column to our orders table. The Foreign Key SyntaxThe "customer" column may only have a value that is the customers table. There are a variety of ways to say this in tech-jargon, depending on what kind of shop you come from it may be simply a foreign_key, or we say that orders is a child table to customers, or we say that orders.customer has referential integrity to customers.customer. They all mean the same thing for our purposes. We could simply do a column placement of customers into the orders table, like so:
but this is wrong because it does not enforce the foreign_key. The Andromeda way to do this is as follows, using the foreign_key declaration:
which has the following effects:
The Database TableIf we look at the database structure, we see that the customer table is there, safe and sound:
The User InterfaceThere are two basic effects of the foreign key on the user interface. The first is that an HTML SELECT appears on the orders screen when entering a customer:
There is also a drilldown-like link that appears on the customers screen, which will automatically display all orders for one customer:
Previous: A SEQUENCE Column
Next: Order Lines Part One
|
