Why do we need “Relationships” between tables at all?

I think the main reason is for data integrity. If you have a relationship between two tables invoice and invoice_item. You won’t be able to add an invoice item that does not related to an invoice. This is what you want!

It’s called referential integrity. It can get pretty messy in your database if you don’t have foreign keys because you could delete and corrupt your data easily.

e.g. You could delete invoice and not it’s corresponding invoice items. This is considered bad.

I think this gives you something to go on.

Leave a Comment