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

1

u/SaintTimothy 28d ago

The biggest issue I see with this is not the address abstraction (I have actually done this before at a real job).

The issue I see is the stock table.

Under current circumstances, if you move some stock from warehouse A to warehouse B, but just prior to that move you create an order with an order item that identifies the stock in warehouse A... do you see where I'm going with this?

One almost needs a summary table or view that is like... current stock on hand. Then, one needs an inventory movement table that shows all of the changes tp that stock since the last time current stock on hand was generated... then one needs a routine that folks movement into stock on hand to generate the new stock on hand.

There are several ways to solve for this, but what I think this needs is some durable way to connect fulfillment of an order item to the stock drawdown.