×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

有哪位朋友能帮着解答一下吗 ? 谢谢!

Questions:

Flyball is a dog sport. Create a database (on paper) to collect the listed information and write pseudocode for the listed queries.

The data will consist of the following:
· Members
· Dogs
· Teams

Rules:
1. Each member can own more than one dog.
2. Each member can belong to more than one team.
3. Each dog can only have one owner.
4. Each dog can only be on one team.
5. Each team has to have one captain.
6. Each team may have one alternate captain.
7. The captain may have a dog.

Queries/Reports
1. Enter a dog, retrieve owner and team information.
2. Enter a member, retrieve dog and team information.
3. Enter a team, retrieve member and dog information.

Thank you
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / 有哪位朋友能帮着解答一下吗 ? 谢谢!
    Questions:

    Flyball is a dog sport. Create a database (on paper) to collect the listed information and write pseudocode for the listed queries.

    The data will consist of the following:
    · Members
    · Dogs
    · Teams

    Rules:
    1. Each member can own more than one dog.
    2. Each member can belong to more than one team.
    3. Each dog can only have one owner.
    4. Each dog can only be on one team.
    5. Each team has to have one captain.
    6. Each team may have one alternate captain.
    7. The captain may have a dog.

    Queries/Reports
    1. Enter a dog, retrieve owner and team information.
    2. Enter a member, retrieve dog and team information.
    3. Enter a team, retrieve member and dog information.

    Thank you
    • You only need 4 tables, Team, Member, Dog and an INT table. Regarding Queries, you need to join the tables. This is a question for IT beginner, for example, me.
      • Then, how do you enforce the rules? such as a dog can belong to only one owner and one team?
        • Link the dog to INT table.
          • Does that guarantee one-dog-one-owner? or one-dog-one-team? INT table usually is for many-to-many relationship.
            • Ok,
              in your INT table, you could have:
              INT_Id (PK)
              Team_Id
              Employee_Id
              .
              .
              .

              In Dogs table,
              you have foreign key to INT_Id (FK).
              • Bad idea..
                Why can't you just make a composite PK including teamID and employeeID in the INT table. That way the Dog table does not lose it autonomous and self-contained nature for an entity.

                I like the 4-table approach though. Just need to add some constraint/index/keys to perfect the solution, right? :)
                • Right, in order to enforce those business rules, we have to put constraints, checks, indexes there.
                  But there's always arguments about a single PK or composite?
                  Pros and cons.
                  I prefer single PK.
                  Well, if you put composite PK, later on, they could change their business rule, for example,

                  "A dog can belong directly to a team (leave member as null)",
                  (Actually, they didn't mention a dog must have a owner, what they say is "Each dog can only have one owner."

                  then you'll struggle with the null as member id is part of the PK. This kind of business change happens everywhere and all the time.
                  I just want to leave the flexibility to myself.
                  Glad to hear your advice.
                  Thanks.
                  • good, point taken.
      • Thank you!
      • 是4个表同时joint吗?条件是什么呢?
        • 你不睡觉啊?
          If you like, you can definitely join 4 tables together. But I like join 3 tables each time.
          Condition is "Equal"