Results 1 to 12 of 12

Thread: ER Diagram(CDM)

  1. #1
    Join Date
    Dec 2011
    Posts
    6

    ER Diagram(CDM)

    Can anyone help me in this Question .
    found the entity type and the constraint , limitation, assumption and diagram


    Represent part of the mlitary command structure of the armies of world. It is desired to represent every command unit and all army personnel, along with their ranks and personal details. Each country has one army who has a Commander-In-Chief. Each army is divided into a number of field armies. Each field army has between 90,000 - 200,000 soldiers and is headed by a General. There is only one Field Marshall in each army. Not all generals head a field army.

    I think that entity type is :
    country
    army
    field

    but i dont now the attribute

    So please if any one can help me??

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smiley4080 View Post
    I think that entity type is :
    country
    army
    field

    but i dont now the attribute
    that's a great start

    for attributes, let's consider your first entity, country

    does each country have a name?

    vwalah!! an attribute

    any other attributes you can think of?

    probably not, so let's move on to army

    does each army have a name?

    vwalah!! an attribute

    any other attributes you can think of?

    what about the number of soldiers in the army?

    another attribute?


    get the idea?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2011
    Posts
    6
    I think the attribute of countru is the name and the primary key is code >> what you said

    country( countryCode, countryName)

    so the entity and there attribute
    is this correct

    - country : name , code , army name
    -Army : army name , country name , field army .
    - field army : solders number , field army name , army name
    - Solders : name , ID , rank
    - General : army name , field army name ,
    - Marshall : army name , ID , filed army name
    - commander – in chief: name ,ID , army name , country name

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    a person exists in their own right (ie has a name, DoB and whatever else you need to associate with that individual

    unless that person is, say a member of the monarchy, its unlikely they will have more than one rank, so probably rank (or role) is part of the person table, but probably is a FK into another table which defines the rank

    if you go down the route of having a separate table for rank then you could have a self referencing link in the rank/roll table which determines the hierarchy. however you may need to be careful if you application needs to know 'equivalence' of roles as this cannot necessarily be derived from the self referencing hierarchy model. this can be circumvented by including some form of level. eg role X is on level y

    the advantage of the hierarchy model is that you can have as many levels as you required (in fact there is no limit on the number of levels in the hierarchy. if you go down the level indicator, make certain that you leave gaps between each level so that there is the opportunity to insert new levels if needs be
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Dec 2011
    Posts
    6
    I think Soldier, Marshall, Commander etc. are roles so that They are not entities.
    so that the entities maybe

    Country(CountryName, Country Code , ArmyID )
    Army (ArmyID ,name, mobile , CPR , Country, rank )

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smiley4080 View Post
    Country(CountryName, Country Code , ArmyID )
    i don't think you want to make country belong to army

    rather, i think you want to make army belong to country

    that way, a country can have more than one army
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Dec 2011
    Posts
    6
    thanks r937 to mention that I forget so that
    entity will be like

    Country (country_code, country_name)
    Army (army_code, army_name, country_code)

    can I add extra entity called
    Soldiers(SoldierID, name)

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smiley4080 View Post
    can I add extra entity called
    Soldiers(SoldierID, name)
    of course

    you can add whatever entities you wish



    but let me ask you about something that i find very serious, and disturbing

    where are all these "ID" columns coming from?

    how do you propose to ask each soldier what her "SoldierID" is?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  9. #9
    Join Date
    Dec 2011
    Posts
    6
    what is your suggestion??

    because i don't now any thing about army is not my major??

  10. #10
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smiley4080 View Post
    what is your suggestion??
    create your ERD without resorting to the use of "ID" columns
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  11. #11
    Join Date
    Dec 2011
    Posts
    6
    create your ERD without resorting to the use of "ID" columns
    but I think primary key is important to make relationship between the relation (Table or entities).

  12. #12
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smiley4080 View Post
    but I think primary key is important to make relationship between the relation (Table or entities).
    you are absolutely right

    but why are you inventing an artificial "ID" column for this purpose?

    surely each entity has some other unique attribute(s) which can be used as the primary key
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •