database-normalization

normalization in database

别说谁变了你拦得住时间么 提交于 2019-12-17 14:28:33
问题 I have one table. How can I normalize this. 回答1: Good question given your data set. Keep in mind the whole point of normalization is to reduce duplication. 3NF is often the best way to go. But given my experience I've found very little benefit to pulling a repeated value out into a different table if it will be the only value in that table. Take for example your most duplicated column, emp_type. If you were to normalize it into a separate table , it would look like this: Emp_Type_Id | Emp

In terms of databases, is “Normalize for correctness, denormalize for performance” a right mantra?

喜你入骨 提交于 2019-12-17 07:12:27
问题 Normalization leads to many essential and desirable characteristics, including aesthetic pleasure. Besides it is also theoretically "correct". In this context, denormalization is applied as a compromise, a correction to achieve performance. Is there any reason other than performance that a database could be denormalized? 回答1: The two most common reasons to denormalize are: Performance Ignorance The former should be verified with profiling, while the latter should be corrected with a rolled-up

In terms of databases, is “Normalize for correctness, denormalize for performance” a right mantra?

寵の児 提交于 2019-12-17 07:12:04
问题 Normalization leads to many essential and desirable characteristics, including aesthetic pleasure. Besides it is also theoretically "correct". In this context, denormalization is applied as a compromise, a correction to achieve performance. Is there any reason other than performance that a database could be denormalized? 回答1: The two most common reasons to denormalize are: Performance Ignorance The former should be verified with profiling, while the latter should be corrected with a rolled-up

Minimum no of tables that exists after decomposing relation R into 1NF?

旧城冷巷雨未停 提交于 2019-12-17 06:54:14
问题 Consider the relation R(A, B, C, D, E, F, G) with the following types of attributes:- Total No of Keys = 1 = {A} Set of Simple (or) Atomic (or) Single Valued Attributes = {B, C} Set of Multivalued Attributes = {D, E} Set of Composite Attributes = { F, G} What would be the minimum no of tables that exists after decomposing relation R into 1NF? (A) 3 (B) 2 (C) 4 (D) 5 My attempt: We needed different table for each multivalued attributes with given key(A), total = 2 Similarly, we needed

Facebook database design?

人走茶凉 提交于 2019-12-17 04:08:57
问题 I have always wondered how Facebook designed the friend <-> user relation. I figure the user table is something like this: user_email PK user_id PK password I figure the table with user's data (sex, age etc connected via user email I would assume). How does it connect all the friends to this user? Something like this? user_id friend_id_1 friend_id_2 friend_id_3 friend_id_N Probably not. Because the number of users is unknown and will expand. 回答1: Keep a friend table that holds the UserID and

Normalization: What does “repeating groups” mean?

泄露秘密 提交于 2019-12-17 02:24:45
问题 I have read different tutorials and seen different examples of normalization, specially the notion of "repeating groups" in the first normal form. From them I have have gathered that repeating groups are "kind-of" multi-valued attributes (e.g. here and here). But we already make separate tables for each multi-valued attribute by including foreign keys from the parent table during the process of mapping an ERM (Entity relationship Model) to a RDM (Relational Data Model)? Reference: this

Does single table inheritance results in denormalization

江枫思渺然 提交于 2019-12-14 03:28:52
问题 We're trying to come up with the data model of Payment Method. There can be several kinds of payment methods like Card, Bank Transfer, Wallet, which further can be categorized for e.g. Card into credit/debit cards, Bank Transfer into ACH/SEPA and the like. So this is about modelling inheritance into database tables. One option is to use single table inheritance. Senior folks in my team call single table as denormalized table. But I don't understand why? I don't see any insert/delete/update

4NF, Multivalued Dependencies without Functional Dependencies

冷暖自知 提交于 2019-12-14 03:05:01
问题 Sorry for asking a question one might consider a basic one) Suppose we have a relation R(A,B,C,D,E) with multivalued dependencies: A->>B B->>D. Relation R doesn't have any functional dependencies. Next, suppose we decompose R into 4NF. My considerations: Since we don't have any functional dependencies, the only key is all attributes (A,B,C,D,E). There are two ways we can decompose our relation R: R1(A,B) R2(A,C,D,E) R3(B,D) R4(A,B,C,E) My question is - are these 2 decompositions final? Looks

Moving to second form

蓝咒 提交于 2019-12-13 18:08:26
问题 Guys, how would you create second form of this table (primary key is: {isbn,copy}): isbn AB-1234-X authorID IC45 authorName I.Conn title The final curtain copy 2 classification Detectivefiction userID xyz44 回答1: A relation is in 2NF iff it's in 1NF, and every non-prime attribute is dependent on the whole of every candidate key (not on just part of any candidate key) The only candidate key is {isbn, copy}. So the question becomes three questions. Is this relation in 1NF? Are any of the non-prime

Database Design for Multiple Room Reservation: One To Many

眉间皱痕 提交于 2019-12-13 14:09:44
问题 Primary Entities: Client Guest Reservation RoomAssignment I want to implement a multiple room reservation database design. First, I want to explain first the concept: The Client is the one who acquires a reservation. The Client can only have 1 reservation at a time The Client can reserve multiple rooms. The Guest is the one who is assigned into a specific room. So for the Table: Client (client_id(PK), Name) Guest (guest_id(PK), Name) Reservation (reservation_id(PK), client_id(FK), roomAss_id