如何针对给定的问题设计数据库架构 [英] How to design DataBase Schema for given problem

查看:82
本文介绍了如何针对给定的问题设计数据库架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

QUE:-一个世界上有多个森林,森林有多个树木,并且树木具有不同类型的叶子和多个叶子.此结构的设计DB架构将获取forestID = 10 ??的所有叶子?
(提示:使用连接)
Plzzz可以帮助我...

QUE:- A world have multiple forest, forest has multiple trees, and trees has different type of leafs and multiple leafs. Design DB Schema of this structure in fetch the all leafs where forestID=10??
(Hint: use join)
Plzzz help me...

推荐答案

这具有家庭作业的常见气味-因此没有代码,只是建议.

您需要存储哪些信息?查看您拥有的对象,并列出它们属于或与之相关的对象.如有需要,请自己画一幅画.

然后查看如何以各种关系存储所有内容,而不会在任何时候重复信息.

然后看看Join的作用.

例如,一棵树可能有许多Leaf对象,但是一个特定的Leaf(例如我手中的叶子")仅与一棵Tree相关联-它不能同时生长在两个Tree上!因此,您可能希望拥有一个Tree表和一个Leaf表,其中的每一行都引用Tree表中的特定行.
This has the familiar odour of homework - so no code, just suggestions.

What information do you need to store? Look at the objects you have, and list out what objects they are part of, or related to. Draw yourself a picture if you need to.

Then look at how you store all that, with the various relationships, without duplicating information at any time.

Then look at what Join does.

For example, a Tree may have many Leaf objects, but a particular Leaf (as in "this leaf here in my hand") will only be associated with a single Tree - it can''t grow on two at the same time! So you will probably want to have a Tree table, and a Leaf table each row of which refers to a specific row in the Tree table.


提示:编写自己的作业...如果我们为您服务,您将不会从中学习任何东西,您可能会找到一份工作,我们将不得不与像您一样无法解决自己的问题的人们一起工作.
最坏的情况:如果我们现在回答您的问题,我们可能必须在10年内使用您的代码/数据库...

我建议您阅读学习书籍并从中学习.如果您的设计有缺陷,您的老师应该能够指出设计的缺陷和原因.那你就会学到的!
如果您有一个特定的问题,例如我有解决方案A和B,那么这对您的观点都是有利与不利的?"我想您会在这里找到愿意帮助的人.

祝你好运!
Hint: Make your own homework... If we do it for you you won''t learn anything from it, you might get a job and we''ll have to work with people like you who can''t solve their own problems.
Worst case scenario: If we answer your question now we might have to work with your code/database in 10 years...

I suggest reading your study books and make something out of it. If your design is flawed your teacher should be able to point out where and why it is faulted. Then you will have learned!
If you have a specific problem like "I have solution A and B, these are the pro''s and cons to both what are you opinions?" I think you''ll find people here more than willing to help.

Good luck!


这篇关于如何针对给定的问题设计数据库架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆