-2

when we have two tables, suppose A and B,there exists one to many relationship between these two, than can there be element from A that are not connected to any element from B?

VTi
  • 1,309
  • 6
  • 14
dato nefaridze
  • 127
  • 1
  • 6
  • Depends on what "one to many relationship" means exactly. Both "one to many" & "relationship" are used with multiple meanings. What you mean by it, exactly? Eg what reference/textbook name & edition are you using & what section & how does it define those terms? And what has your own research & exploration shown? Use enough words, sentences & references to parts of examples to clearly & fully say what you mean. – philipxy Jun 04 '20 at 15:25
  • See my comment on the currently accepted answer, by VarunTiwari. – philipxy Jun 04 '20 at 15:39

1 Answers1

0

One to many relationship between relational tables is a concept that primarily means that if there is a record in table A, then it can have many associated records in table B.

For e.g. customer_id record in table A can have many loans for that customer in table B. So 1 customer_id associated with many loan_ids in another table.

Coming back to your question, it is possible that 1 loan_id in loan_table can have multiple guarantors in guarantor_table and it is also possible that a loan does not have a guarantor associated with it. So even though there is one to many relationship between the tables it does not mean it will always have many records in table B for one record in table A.

Check this link - What is the difference of partiality and optionality when drawing ER diagrams

VTi
  • 1,309
  • 6
  • 14
  • ... unless they are using a design method where "1:M" excludes "0-or-1:M". See my comment on the question. The question does not define its terms. It isn't clear. – philipxy Jun 04 '20 at 15:36
  • I agree. Out of curiosity, is there a way to define these on database level. – VTi Jun 04 '20 at 15:40
  • If you agree, then you agree that your answer is wrong, since you don't know what the asker is trying to ask; moreover unclear questions should be downvoted & closed & commented on, not answered. Your comment question is, like the question post, not clear. An SQL DBMS, depending on what the DBMS offers of SQL, has certain ways of expressing certain constraints & between declarations & triggers can express any constraint. So the answer is a rather unhelpful yes. But you don't say what exact condition you mean. Whatever you have in mind, it will also be an old SO faq. – philipxy Jun 04 '20 at 15:49
  • From what I see and understand in the question , Is there a possibility that an element in A is not connected to element in B when there is one-to-many relationship between two. And my answer says it is possible with the example. Help me understand what is wrong ? – VTi Jun 04 '20 at 15:54
  • Re what is wrong, see my 1st comment. Your post is corrcct only for a certain meaning for 1:M but you don't know what the asker means by it. In some methods/presentations "1:M" includes "0-or-1:M" & in others it excludes "0-or-1:M". – philipxy Jun 04 '20 at 16:15
  • I have given him example of cases where it is possible. and now edited my answer with a link to explain further. – VTi Jun 04 '20 at 16:18
  • I agree to disagree. – VTi Jun 04 '20 at 16:53