![]() |
|
|
#1
|
|||
|
|||
|
Hi, all.
I am going for the record of "World's Simplest Question." I'm new to Access, although a seasoned hand at Excel/VBA, so my lack of perception is frustrating. In the book I have obtained to help me is the following quote: "A one-to-many relationship is created by placing the value primary key of one table into the other table as a foreign key(empahsis mine.) For example, the customer number, which is the primary key of the customers table, becomes the foreign key of the orders table." In theory, fine. This is so that for every order recorded, the orders table doesn't need an additional 17 fields duplicating every customers' data every time. The link between the customer number field and the customers table takes care of that. The dilemma: Wouldn't there already be a customer identification field someplace in the orders table, and if there isn't, how will the insertion of the customer number fields guarantee the correct customer number will go with the correct order? If there already is a customer id field, then simply designating that as the foreign key for this relationship is elementary - it's the "placing into" part that I can't get my head around: Simply, when inserting the column of customer ids, "How will it know?" Thanks and I hope I don't sound like a whiney boob. |
|
#2
|
||||
|
||||
|
Hi corquando,
The word syntax from your book is describing what you should do if you're "designing" a database and the tables have not yet been built, or at least, filled with data. It appears you're asking your question (of what the book says) from the perspective that the tables & data already exist, and as you've surmised, it's a little late by then. Cheers,
__________________
Docendo discimus. Please:
|
|
#3
|
|||
|
|||
|
And there we have it.
I had nightmares of having to manually enter 25000 records or some such by, as you say, coming upon the scene late, but your explanation provides the necessary perspective. Thanks. BTW, I extensively use the Excel/VBA forum that this looks to be a sister to, so finding this one is going to be a real boon. And I do search for existing answers before posting . . . usually. ![]() Thanks again! |
|
| Bookmarks |
| Tags |
| foreign, key, primary |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simplest question... | andrewhunt | Reports | 1 | 01-20-2009 07:34 AM |