MySQL Forums
Forum List  »  MySQL Workbench

Relationships
Posted by: Albert van Dam
Date: February 11, 2008 02:29AM

Hi,

I've played with MySQL Workbench OSS during the weekend and it is quite a helpful tool - especially the diagrams.

I have the following situation:

+----------------+
| account_types |
+----------------+
| account_id PK |
| description |
| ... |
+----------------+

+-----------------+
| customers |
+-----------------+
| customer_id PK |
| account_type FK | (account_types.account_id)
| ... |
+-----------------+

In this scenario, one account type can be used for multiple customers.

With the way I want it to work, I have a many to one relationship (many customers with the same account type).

When having customers.account_type as a foreign key to account_types.account_id MWB has a one to many relationship with one customer and many account types which is the opposite of the requirement.

When using the diagram to define the relationship, customer_id is added as a foreign key to account types which is also incorrect.

How would I go about defining that in MySQL workbench?

Also it would be really great to be able to define foreign keys over multiple databases or at least be able to do this to indicate relationships between data in multiple databases. Using the diagram this can be done but not when editing the foreign keys tab.

Options: ReplyQuote


Subject
Views
Written By
Posted
Relationships
4116
February 11, 2008 02:29AM
2568
February 11, 2008 03:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.