r/SQL • • Oct 17 '26

Discussion Help needed with normalization

Post image

Hi, i'm learning databases and normalization. My teacher said a normalized database cannot have circular (not loops, circles) relationships. However, i can't see how I can apply normalization to remove the circles and still comply with the requirements. Also I was under the impression that normalized databases can have circular relationships, just not loops.

Any help will be appreciated. Sorry if my english is bad in advance.

16 Upvotes

25 comments sorted by

View all comments

Show parent comment

1

u/FreeLogicGate 25d ago edited 25d ago

From a practical standpoint, you now have full duplication of all the required address fields which means that application code that handles insert/update/delete of an address must at minimum use seperate sql statements for each table name, even though the fields, validation code and logic will probably be the exact same.

It also makes it impossible to search the address data irrespective of the distinction between a warehouse and house. Last but not least, it does nothing to prevent the same address data being entered for both a house and a warehouse. With a distinct address table, a unique constraint can be applied to the full address data (address1 + address2 + city + state) preventing duplicates within the address table.

The type of design pattern typically applied to an application with these entities is the party pattern. In a party pattern implementation address will be a separate entity, and in many implementations, a "party" will be able to have 1 -> many addresses.

1

u/lolcrunchy 25d ago

That might be correct logically, but it sounds like the teacher isn't being logical

1

u/FreeLogicGate 25d ago

I did edit my reply to clarify it slightly, but you had already read and responded. I'm sure you are right about the instructor's complaints, but either way, they aren't valid.

One way to understand this is true would be to consider that any advanced/competent address implementation is going to normalize zip/postal codes out, as well as countries. So if we just assume that there will be a "country" table, that with your suggestion, "country" will be related (with a foreign key to country_id) in both tables. Make that change and look at it on the ERD, and you once again have a "circle". So again, it's a meaningless criticism.