Hi, my name is Dejan, I work as amateur programmer for 20 years.
Mostly I work on point of sale apps and bookkeeping apps.
Today I am mainly using Spring and Angular programming frameworks.
My apps up to now were succesfully created without using sql table relations at all, and they are all working without hickups after all these years.
I am trying to implement database relations in my sql desing but some things confuses me for years and keeps me from using relations in my apps desing.
I am interested how to store documents in tables, particullary invoices.
In all my apps I store full data in my invoice tables, meaning in my products columns i am storing full product name and price, in customer columns full name address of customers, practically duplicating data from customers and products tables and storing it in invoice tables, because i am not using relations.
But If I use relations to connect my invoice table with customers and products tables to avoid duplication of data I cannot allow to user to change product price or customer address because it will affect/change data in my all invoices that are connected by id of that product or customer.
But changing product prices or names or customers name/addresses are daily tasks of users.
So my conclusion is NOT to use relations in tables when storing documents because they need to be saved with exact data at the time when they were created.
If this is the case for storing documents in tables, then when to use relations at all?
Mostly I work on point of sale apps and bookkeeping apps.
Today I am mainly using Spring and Angular programming frameworks.
My apps up to now were succesfully created without using sql table relations at all, and they are all working without hickups after all these years.
I am trying to implement database relations in my sql desing but some things confuses me for years and keeps me from using relations in my apps desing.
I am interested how to store documents in tables, particullary invoices.
In all my apps I store full data in my invoice tables, meaning in my products columns i am storing full product name and price, in customer columns full name address of customers, practically duplicating data from customers and products tables and storing it in invoice tables, because i am not using relations.
But If I use relations to connect my invoice table with customers and products tables to avoid duplication of data I cannot allow to user to change product price or customer address because it will affect/change data in my all invoices that are connected by id of that product or customer.
But changing product prices or names or customers name/addresses are daily tasks of users.
So my conclusion is NOT to use relations in tables when storing documents because they need to be saved with exact data at the time when they were created.
If this is the case for storing documents in tables, then when to use relations at all?
Last edited: