2

enter image description here

One B can have only one A, but one A can be appeared in B up to 3 only.

Suppose I have the following code to create new tables:

create table A (
A_id number constraint Aid_pk primary key);

create table B (
B_id number constraint Bid_pk primary key,
A_id number constraint ref_fk references A(A_id));

This is the standard one-to-many relationship, how can I change it to limit the max number of references?

pokpkk
  • 21
  • 2
  • I think the only option available is to use trigger. – Ankit Bajpai Oct 31 '22 at 18:44
  • Does this answer your question? [Oracle: constraint preventing insert more than N (variable) rows](https://stackoverflow.com/questions/59467640/oracle-constraint-preventing-insert-more-than-n-variable-rows). Or [Modeling One-to-Constant Relationship](https://stackoverflow.com/questions/1235544/modeling-one-to-constant-relationship) – astentx Oct 31 '22 at 20:02

0 Answers0