HabibValil
New member
- Local time
- Tomorrow, 00:02
- Joined
- Jan 20, 2022
- Messages
- 17
I have two simple tables: Tcustomers and Torders. I have related the CustomerID of Tcustomers to CustomerID in Torders. A one-to many relationship with Enforce Referential Integrity checked. And cascade update and cascade delete both checked.
Now I should be unable to enter a new Order in Torder unless I introduce its Customer in the same record. right? But without having any customers in Tcustomers, I can still add orders.
to be more precise: if CustomerID default value in Torder is set to zero ( as it is by default when you create a number field in table), I can not add an Order without a related CustomerID. But if I remove that 0 in the default value of CustomerID in Torders, then I can add Orders with the CustomerID field empty(Null?).
why can we add orphan Orders when the CustomerID field in Torders is empty(Null)?
I can set the "Required" property (for CustomerID in Torders) to "Yes" and prevent orphan Orders. But I expect the referential integrity to do that, Am I misunderstanding something?
Now I should be unable to enter a new Order in Torder unless I introduce its Customer in the same record. right? But without having any customers in Tcustomers, I can still add orders.
to be more precise: if CustomerID default value in Torder is set to zero ( as it is by default when you create a number field in table), I can not add an Order without a related CustomerID. But if I remove that 0 in the default value of CustomerID in Torders, then I can add Orders with the CustomerID field empty(Null?).
why can we add orphan Orders when the CustomerID field in Torders is empty(Null)?
I can set the "Required" property (for CustomerID in Torders) to "Yes" and prevent orphan Orders. But I expect the referential integrity to do that, Am I misunderstanding something?
Last edited: