Using Multiple Relationships

Just as two entities in real life can be connected in multiple ways, so can two entities in a database. For example, two people can be on a checking account together and on a mortgage together. Likewise, there are situations in real life where a relationship of one kind precludes a relationship of different kind. An example of this might be if someone has a relationship of "sibling" to one person, he or she can't also have a relationship of "married" to that same person.

Visual Query Builder has specific ways of selecting and displaying "and" and "or" relationships. When you use the Add connected items dialog box to select relationships, if you select more than one relationship at the same time, Visual Query Builder interprets this as an "or" relationship. That means it will look for entities that have one relationship or the other.

The image shows an example of an "or" relationship in the Add connected items dialog box:

Query image

It adds entities who make deposits to or withdrawals from their account to the workspace.

Entities who deposit or withdraw relationships

Alternatively, if you select more than one relationship at different times, in separate steps, Visual Query Builder interprets this as an "and" relationship. Here is an example of an "and" relationship in the Add connected items dialog box.

Customer has credit card account
Customer makes payment to credit card

That means it will look for entities that have both relationships, not just one or the other. It would return entities who have credit card accounts and made payments on those accounts.

Customer has account and makes payments