Hello.
I've got a database which has the following general structure:
Customer_Details - stores general customer information, including a customer_ID
Customer_Purchase_Link - stores customer_IDs and purchase_IDs so one can keep track of each customer's purchase history.
Various other tables, all using purchase_ID as a foreign key.
In summary: [Customer_Details]-[Customer_Purchase_Link]- [...various other tables...]
When a new customer is added to the system, is there an easy way to automatically generate a record in the link table as well as corresponding entries in all the other tables?
Similarly, when a new purchase is added to the system and linked to a certain customer, is there an easy way of making entries for this purchase in all the other tables too?
I've designed similar databases before and they work very efficiently apart from this point. In general I've just put code behind the various "add purchase" (or whatever) buttons to add all the records.
It occurs to me that there must be a better way, such as putting code behind a table so that when a record is added to that table, records are added to other tables using the same ID.
Thanks in advance for any help.
I've got a database which has the following general structure:
Customer_Details - stores general customer information, including a customer_ID
Customer_Purchase_Link - stores customer_IDs and purchase_IDs so one can keep track of each customer's purchase history.
Various other tables, all using purchase_ID as a foreign key.
In summary: [Customer_Details]-[Customer_Purchase_Link]- [...various other tables...]
When a new customer is added to the system, is there an easy way to automatically generate a record in the link table as well as corresponding entries in all the other tables?
Similarly, when a new purchase is added to the system and linked to a certain customer, is there an easy way of making entries for this purchase in all the other tables too?
I've designed similar databases before and they work very efficiently apart from this point. In general I've just put code behind the various "add purchase" (or whatever) buttons to add all the records.
It occurs to me that there must be a better way, such as putting code behind a table so that when a record is added to that table, records are added to other tables using the same ID.
Thanks in advance for any help.