dbTalk Databases Forums  

In MySQL Workbench.

comp.databases.mysql comp.databases.mysql


Discuss In MySQL Workbench. in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SpreadTooThin
 
Posts: n/a

Default In MySQL Workbench. - 01-28-2011 , 01:08 PM






I'm poking around in MySQL Workbench and am exploring the Entity
Relationship diagram editor.
Very Cool.

In my previous example I had a customer table and an Orders table.
I am hoping the entity relationship diagram editor will help me create
my sql for me. (including foreign key constrants).

As I've mentioned...
The relationship between these two tables is that there can be 0 to n
orders for a customer.
In the entity relationship diagram editor I see 1:1, 1:n, n:m.
As I see no 0 to n, should I assume that n:m is what should be chosen?

In crow foot notation, is there a diference between a dotted vs a
solid line as 1:1 and 1:n have both options.
(solid or dotted)

Reply With Quote
  #2  
Old   
Erick T. Barkhuis
 
Posts: n/a

Default Re: In MySQL Workbench. - 01-28-2011 , 01:22 PM






SpreadTooThin:


Quote:
In crow foot notation, is there a diference between a dotted vs a
solid line as 1:1 and 1:n have both options.
(solid or dotted)
Dotted means: zero or more.
Solid means: one or more (required relationship).



--
Erick

Reply With Quote
  #3  
Old   
SpreadTooThin
 
Posts: n/a

Default Re: In MySQL Workbench. - 01-28-2011 , 01:45 PM



On Jan 28, 12:22*pm, "Erick T. Barkhuis" <erick.use-... (AT) ardane (DOT) c.o.m>
wrote:
Quote:
SpreadTooThin:

In crow foot notation, is there a difference between a dotted vs a
solid line as 1:1 and 1:n have both options.
( or dotted)

Dotted means: zero or more.
Solid means: one or more (required relationship).

--
Ericki
ahh! so it could be 1:0

Reply With Quote
  #4  
Old   
Helmut Chang
 
Posts: n/a

Default Re: In MySQL Workbench. - 01-29-2011 , 09:37 AM



Am 28.01.2011 20:22, schrieb Erick T. Barkhuis:
Quote:
SpreadTooThin:


In crow foot notation, is there a diference between a dotted vs a
solid line as 1:1 and 1:n have both options.
(solid or dotted)

Dotted means: zero or more.
Solid means: one or more (required relationship).
That's not correct.

Dotted means: unidentifying relationship.
Solid means: identifying relationship.

An identifying relationship is one, where the foreign key is also part
of the primary key.

AFAIK an identifying relationship should be used, when the foreign key
must not change. The OPs example with customers and orders in another
thread is IMHO a good example:

When an order is created, it always "belongs" to a customer. And the
customer of the order can not change (normally). So here I would use an
identifying relationship, making the ID of the customer a part of the PK
of the order.

On the other hand, if you have a table with countries and a FK to a
country in the customer's address, that would be an unidentifying
relationship, because the country of a customer may change.

zero or more vs. one ore more is a matter of the cardinality and is
displayed like that in crow foot notation:

zero or more: >o-----
one or more: >|-----

<http://www2.cs.uregina.ca/~bernatja/crowsfoot.html>

Helmut

Reply With Quote
  #5  
Old   
SpreadTooThin
 
Posts: n/a

Default Re: In MySQL Workbench. - 01-29-2011 , 09:50 AM



On Jan 29, 8:37*am, Helmut Chang <use... (AT) helmutchang (DOT) at> wrote:
Quote:
Am 28.01.2011 20:22, schrieb Erick T. Barkhuis:

SpreadTooThin:

In crow foot notation, is there a diference between a dotted vs a
solid line as 1:1 and 1:n have both options.
(solid or dotted)

Dotted means: zero or more.
Solid means: one or more (required relationship).

That's not correct.

Dotted means: unidentifying relationship.
Solid means: identifying relationship.

An identifying relationship is one, where the foreign key is also part
of the primary key.

AFAIK an identifying relationship should be used, when the foreign key
must not change. The OPs example with customers and orders in another
thread is IMHO a good example:

When an order is created, it always "belongs" to a customer. And the
customer of the order can not change (normally). So here I would use an
identifying relationship, making the ID of the customer a part of the PK
of the order.

On the other hand, if you have a table with countries and a FK to a
country in the customer's address, that would be an unidentifying
relationship, because the country of a customer may change.

zero or more vs. one ore more is a matter of the cardinality and is
displayed like that in crow foot notation:

zero or more: >o-----
one or more: *>|-----

http://www2.cs.uregina.ca/~bernatja/crowsfoot.html

Helmut
Thanks.. I see your point.

Reply With Quote
  #6  
Old   
Erick T. Barkhuis
 
Posts: n/a

Default Re: In MySQL Workbench. - 01-29-2011 , 10:42 AM



Helmut Chang:

Quote:
Am 28.01.2011 20:22, schrieb Erick T. Barkhuis:
SpreadTooThin:


In crow foot notation, is there a diference between a dotted vs a
solid line as 1:1 and 1:n have both options.
(solid or dotted)

Dotted means: zero or more.
Solid means: one or more (required relationship).

That's not correct.

Dotted means: unidentifying relationship.
Solid means: identifying relationship.
http://www2.cs.uregina.ca/~bernatja/crowsfoot.html
You're right, Helmut.
I was thinking of the Oracle CASE Notation, which uses dotted and solid
lines differently:
http://cisnet.baruch.cuny.edu/holowc...yrelationship/

[When you're getting older, having many standards available is becoming
a luxury: there's always something that makes you look right, even when
you're confused...] :-)


--
Erick

Reply With Quote
  #7  
Old   
SpreadTooThin
 
Posts: n/a

Default Re: In MySQL Workbench. - 01-29-2011 , 10:59 AM



On Jan 29, 9:42*am, "Erick T. Barkhuis" <erick.use-... (AT) ardane (DOT) c.o.m>
wrote:
Quote:
Helmut Chang:



Am 28.01.2011 20:22, schrieb Erick T. Barkhuis:
SpreadTooThin:

In crow foot notation, is there a diference between a dotted vs a
solid line as 1:1 and 1:n have both options.
(solid or dotted)

Dotted means: zero or more.
Solid means: one or more (required relationship).

That's not correct.

Dotted means: unidentifying relationship.
Solid means: identifying relationship.
http://www2.cs.uregina.ca/~bernatja/crowsfoot.html

You're right, Helmut.
I was thinking of the Oracle CASE Notation, which uses dotted and solid
lines differently:http://cisnet.baruch.cuny.edu/holowc...yrelationship/

[When you're getting older, having many standards available is becoming
a luxury: there's always something that makes you look right, even when
you're confused...] :-)

--
Erick
Just to be sure, because I don't see any dotted line crow foot
notation in you link.
1:n means... the customer can have 0 to n orders, but there is no
notation that says that there must be at least 1.
(In the ERD editor of mysql)

Reply With Quote
  #8  
Old   
Erick T. Barkhuis
 
Posts: n/a

Default Re: In MySQL Workbench. - 01-29-2011 , 11:40 AM



SpreadTooThin:

Quote:
1:n means... the customer can have 0 to n orders, but there is no
notation that says that there must be at least 1.
(In the ERD editor of mysql)
1:n means there must be at least 1 on the left side.
0:n means there must not be anything on the left side for a given tuple
at the right side.

In MySQL Worksbench, right click a drawn relationship, choose "Edit
relationship..."
Then in the bottom part of the window, click the tab "Foreign Key".
Here, you have two check boxes with caption "Mandatory" (one for the
left side and one for the right side) and a check box in the middle for
"Identifying relationship". Use those terms to read up in the "Help
(F1)" of the MySql Workbench.
[You appear not to have opened the Help feature, yet]



--
Erick

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.