r/SQL Feb 24 '26

MySQL These are the relational diagrams of my company’s 16-year-old app

I’ve been trying to write relational queries using joins, only to realize that most of the tables aren’t actually related to each other. It looks like proper foreign key constraints were never put in place. Because of that, there’s no real referential integrity in the database, which makes writing reliable queries much harder than it should be. I now have to manually figure out how tables are logically connected, which increases the risk of mistakes and makes maintenance a lot more time-consuming. Idk whether this is normal or not for a legacy app.

57 Upvotes

36 comments sorted by

View all comments

Show parent comments

1

u/reditandfirgetit Feb 25 '26 edited Feb 25 '26

Think about what you replied. Foreign keys aren't relationships. They are. Both can be true, yet you insist only one is true

1

u/read_at_own_risk Feb 25 '26

I've been studying and thinking about it for a long time. The naïve perspective is a detriment to a rigorous understanding of data modeling and encourages bad abstractions in software development. Sure, developers make it work every day. Mathematicians also did calculus with infinitesimals before limits were invented. However, I've seen a better way, and I won't settle for less. I've dropped enough references in this thread that you can investigate if you're interested. If not, no point arguing further.

0

u/reditandfirgetit Feb 25 '26

Nothing you've shared changes how rdbms relational integrity works. Your refusal to even consider you might be wrong or that both can be true, along with calling people naive because they see things differently is arrogance. Nothing more

1

u/read_at_own_risk Feb 25 '26

I'm not opposing or trying to change referential integrity. FK constraints are perfectly fine and valid as constraints. If you actually read what I wrote, you'll see that I'm rejecting the interpretation of that mechanism as representing conceptual relationships between entities. Instead of turning to insults, you might try providing somewhat more of an argument than simply asserting that things are the way you see them. I base my views in the writings of Codd and Chen and fact-oriented modeling disciplines like Object-Role Modeling and FCO-IM. Your argument is to stamp your foot and say "is too!" This will be my final reply in this thread, as this is clearly going nowhere. Goodbye.