database-normalization

should this database table be normalized?

允我心安 提交于 2019-12-07 08:02:30
问题 i have taken over a database that stores fitness information and we were having a debate about a certain table and whether it should stay as one table or get broken up into three tables. Today, there is one table called: workouts that has the following fields id, exercise_id, reps, weight, date, person_id So if i did 2 sets of 3 different exercises on one day, i would have 6 records in that table for that day. for example: id, exercise_id, reps, weight, date, person_id 1, 1, 10, 100, 1/1/2010

Normalized and immutable data model

≯℡__Kan透↙ 提交于 2019-12-06 18:26:13
问题 How does Haskell solve the "normalized immutable data structure" problem? For example, let's consider a data structure representing ex girlfriends/boyfriends: data Man = Man {name ::String, exes::[Woman]} data Woman = Woman {name :: String, exes::[Man]} What happens if a Woman changes her name and she had been with 13 man? Then all the 13 man should be "updated" (in the Haskell sense) too? Some kind of normalization is needed to avoid these "updates". This is a very simple example, but

Best practice for setting non-normalized columns in Yii2

ぐ巨炮叔叔 提交于 2019-12-06 13:35:22
Question to all Yii2 normalization geeks out there. Where is the best place to set non-normalized columns in Yii2? Example, I have models Customer , Branch , CashRegister , and Transaction . In a perfect world, and in a perfectly normalized Database, our Transaction model would have only the cashregister_id , The CashRegister would store branch_id , and the Branch would store customer_id . However due to performance issues, we find ourselves obliged sometimes though to have a non-normalized Transaction model containing the following: cashregister_id branch_id customer_id When creating a

What kind of FD or MVD exists in 5NF?

拈花ヽ惹草 提交于 2019-12-06 05:01:37
From the " A Simple Guide to Five Normal Forms in Relational Database Theory ": Fourth and fifth normal forms both deal with combinations of multivalued facts. One difference is that the facts dealt with under fifth normal form are not independent, in the sense discussed earlier. Following rule has been mentioned: Suppose that a certain rule was in effect: if an agent sells a certain product, and he represents a company making that product, then he sells that product for that company. ACP ----------------------------- | AGENT | COMPANY | PRODUCT | |-------+---------+---------| | Smith | Ford |

Lossless decomposition vs Dependency Preservation

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 03:06:09
Does anyone of them implies the other? My logic is that if all dependencies are preserved, then there is no loss of information and similarly, if decomposition is lossless then no functional dependency must have been violated. So essentially, dependency preservation is a way to ensure that your decomposition is lossless. I am having a hard time accepting/denying it. So do both of these guarantee one another or are there cases where one can be achieved without the other? In general these are two independent things: you can have a lossless decomposition without dependency preservation, as well

How to reference groups of records in relational databases?

♀尐吖头ヾ 提交于 2019-12-05 19:27:38
Suppose we have the following table structures: Humans | HumanID | FirstName | LastName | Gender | |---------+-----------+----------+--------| | 1 | Issac | Newton | M | | 2 | Marie | Curie | F | | 3 | Tim | Duncan | M | Animals | AmimalID | Species | NickName | |----------+---------+----------| | 4 | Tiger | Ronnie | | 5 | Dog | Snoopy | | 6 | Dog | Bear | | 7 | Cat | Sleepy | I wonder how to reference a group of records in other tables. For example, I have a Foods table and an EatenBy column. Foods | FoodID | FoodName | EatenBy | |--------+----------+---------| | 8 | Rice | ??? | What I want

should this database table be normalized?

孤人 提交于 2019-12-05 15:42:09
i have taken over a database that stores fitness information and we were having a debate about a certain table and whether it should stay as one table or get broken up into three tables. Today, there is one table called: workouts that has the following fields id, exercise_id, reps, weight, date, person_id So if i did 2 sets of 3 different exercises on one day, i would have 6 records in that table for that day. for example: id, exercise_id, reps, weight, date, person_id 1, 1, 10, 100, 1/1/2010, 10 2, 1, 10, 100, 1/1/2010, 10 3, 1, 10, 100, 1/1/2010, 10 4, 2, 10, 100, 1/1/2010, 10 5, 2, 10, 100,

To Normalize or Not To Normalize

感情迁移 提交于 2019-12-05 11:23:50
I am designing a System which has different types of Addresses. For example, a Person Address, A Hotel Address, An Airport Address, An Office Address. I am involved in a discussion where I am of the opinion that as the addresses are different(of different entities Hotel, Airport etc.) the addresses should be stored in separate tables. I think this would improve performance. There is another opinion to have all the addresses in the same table. I am using PostgreSQL and am looking at over 10 million records. What do you think is the better design? I look forward to your opinions. Regards,

Am I Properly Normalizing this Data

落花浮王杯 提交于 2019-12-05 02:30:06
I am completing normalization exercises from the web to test my abilities to normalize data. This particular problem was found at: https://cs.senecac.on.ca/~dbs201/pages/Normalization_Practice.htm (Exercise 1) The table this problem is based of is as follows: The unnormalized table that can be created from this table is: To comply with First Normal form, I have to get rid of repeating fields in the table by moving visitdate, procedure_no, and procedure_name to their own respective tables: This also complies with 2NF and 3NF which makes me question whether I have performed the process of

Normalized and immutable data model

一个人想着一个人 提交于 2019-12-04 23:53:04
How does Haskell solve the "normalized immutable data structure" problem? For example, let's consider a data structure representing ex girlfriends/boyfriends: data Man = Man {name ::String, exes::[Woman]} data Woman = Woman {name :: String, exes::[Man]} What happens if a Woman changes her name and she had been with 13 man? Then all the 13 man should be "updated" (in the Haskell sense) too? Some kind of normalization is needed to avoid these "updates". This is a very simple example, but imagine a model with 20 entities, and arbitrary relationships between them, what to do then? What is the