relational

BCNF decomposition process

喜欢而已 提交于 2019-12-20 06:16:05
问题 What is the BCNF decomposition for these dependencies? A->BCD BC->DE B->D D->A What is the process to get to the answer? 回答1: We can first convert the relation R to 3NF and then to BCNF. To convert a relation R and a set of functional dependencies( FD's ) into 3NF you can use Bernstein's Synthesis . To apply Bernstein's Synthesis - First we make sure the given set of FD's is a minimal cover Second we take each FD and make it its own sub-schema. Third we try to combine those sub-schemas For

Storing folder hierarchy in relational database

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 08:01:07
问题 I have objects representing folders and I'm wondering if they should be represented in the database. On the one hand it seems like the easiest way would be to not represent folder objects and just store a path value for objects contained in a folder. Problems I see with this is that you can't persist an folder whose descendants do not contain any items, which isn't too big of a deal. Also I don't have a clear idea of how to load the folder hierarchy to display (such as in a TreeView) without

(De)Normalization of two relations

隐身守侯 提交于 2019-12-18 15:33:46
问题 People who read C.J.Date's Introduction to Database System or books of similar level should not have problems with definition of normalization and denormalization. However, memory is not what it used to be and I find myself often looking at some design and saying that it is not normalized even though I can not find which of the normal forms it is breaking. The actual example that illustrate it is: If we have relations r1 (A, B, C) and r2 (A, D) with FDs: AB->C and A->D and r1 represent

How do you document your database structure? [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 18:06:35
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . Many database systems don't allow comments or descriptions of tables and fields, so how do you go about documenting the purpose of a table/field apart from the obvious of having good naming conventions? (Let's assume for now that "excellent" table and field names are not enough to

Why should I use document based database instead of relational database?

馋奶兔 提交于 2019-12-17 06:59:10
问题 Why should I use document based database like CouchDB instead of using relational database. Are there any typical kinds of applications or domains where the document based database is more suitable than the relational database? 回答1: Probably you shouldn't :-) The second most obvious answer is you should use it if your data isn't relational. This usually manifests itself in having no easy way to describe your data as a set of columns. A good example is a database where you actually store paper

Relational design scenario: restrict children relations

穿精又带淫゛_ 提交于 2019-12-13 14:27:39
问题 please consider the following scenario. An pet owner may have multiple cats, and may also have multiple dogs. Some of the dogs are related (ie they fight :-) ) with some of the cats of the same owner . The following relational design does not impose this restriction, as Cats and Dogs of different owners may be related. Is there a way to impose this restriction by relational design? 回答1: You'd need to use identifying relationships to migrate the owner's PK down both "sides" and to the "bottom"

Quick tips on relational database design for MySQL

泪湿孤枕 提交于 2019-12-13 07:33:24
问题 I have a webapp I'm making that stores user information, and their preferences regarding the app. Is this something worth splitting into two databases? I was thinking one table "users" with fields "id, useridfromFacebook, facebookRealName" (so 1, 52052025295, Alex McP), and then have a table "preferences" with fields "id, useridfromFacebook, emails, colors, SomeQuoteorSomething" (4, 52052025295, 1, 441155, 'Only The Good Die Young') I've never been taught/learned myself about DB setup, but

Is it true that a database is 2NF by default if the table only has 1 primary key?

谁说胖子不能爱 提交于 2019-12-12 20:40:52
问题 i.e. there is a table with only 1 primary key (no composite keys). Is it 2NF by default? Assume that it is already 1NF 回答1: http://en.wikipedia.org/wiki/Second_normal_form in your example, PatNo is not a primary key since PatNo may see more than one doctor, or have more than one appNo. 回答2: Loosely speaking, a table is in 2NF if and only if it's in 1NF, and there are no partial key dependencies. That's not quite the same thing as saying a table that has a single-column primary key is in 2NF.

Theta Join in Relational Algebra Correctness

╄→гoц情女王★ 提交于 2019-12-12 05:32:58
问题 Considering these two tables: Band (band_id, band_name) Band_Member (band_id, member_name, dob, country, sex) The task: List the names of band members and the names of the bands they are in using the theta Join. Well, my doubt is in the step to show only the band_name and member_name after the join. This is how I've done the theta-join: σ Band_Member.band_id = Band.band_id (Band_member x Band) And this is how I think it might be correct to show only the band_name and member_name: Π band_name,

Relational database design cycle

三世轮回 提交于 2019-12-12 05:03:54
问题 I have the following database design: I want to add a new table named Task, which would have a one-to-many relationship with a Project(Project will have one or more tasks and particular task will belong to only one project). Next users will also be assigned to different tasks in a project(basically User table needs another many to many relationship with a Task, but that creates a loop in the design). Is this a good practice or should I avoid making loops in a design? 回答1: Next users will also