database-normalization

Normalize a table with a two-column primary key and one other column

那年仲夏 提交于 2019-12-25 12:04:20
问题 My DataTable has 3 columns: A, B and C. None are guaranteed to have unique entries, in non-trivial cases every column will have non-unique entries. The combination of {A, B} is guaranteed to be unique. Because ADO.NET DataTable allows using multiple columns as the primary key, I use A and B as my primary key. A vs B represents a matrix with 0 as the default value, so it's possible for me to guarantee that entries of B will come from a finite pool and for each entry of A, every possible {A, B}

Why doesnt this complex MySQL query work?

 ̄綄美尐妖づ 提交于 2019-12-25 04:19:55
问题 I have 2 tables; members and teams members table memberID, firstName, lastName (firstName and lastName are fulltext indexes) teams table team_id, member1ID, member2ID Here's my query $sql = "SELECT a.* "; $sql .= "FROM teams a WHERE "; $sql .= "a.member1ID IN (SELECT b.memberID FROM members b "; $sql .= "WHERE MATCH(b.firstName, b.lastName) AGAINST('$q' IN BOOLEAN MODE)) "; $sql .= "OR a.member2ID IN (SELECT b.memberID FROM members b "; $sql .= "WHERE MATCH(b.firstName, b.lastName) AGAINST('

Follow up: Access considers query too complex after normalization

走远了吗. 提交于 2019-12-25 01:13:17
问题 At first, I want to apologize for the n +1st Query-too-complex-question. Since I've been told that my dtabase deserves normalisation, I tried to do the very same thing with a normalised setup. However, Access complains about a too complex query by now. What I want to do: Starting point is a query that yields fields Item ID, Difference in attribute 1, Group of attribute 1, Difference in Attribute 2, Group of attribute 2,... (about 10.000 rows, query is just an equijoin of the two datasets to

Why aren't all the normal forms used?

主宰稳场 提交于 2019-12-24 16:21:57
问题 Mostly if you see the internet only up to 3rd or 4th normal forms are discussed, if you read there are up to 7 normal forms so why aren't they discussed by people on the internet you hardly find any example related to them whether on YouTube or any any other place. 回答1: Mostly a combination of 1. ignorance of benefits and 2. limitations of DBMSs. One could blame the limitations on the ignorance--of designers & implementers but maybe mostly of users, leading to no market, leading to

boyce codd and finding candidate keys

狂风中的少年 提交于 2019-12-24 14:06:59
问题 needing desperate help with understanding boyce codd and finding the candidate keys. i found a link here http://djitz.com/neu-mscs/how-to-find-candidate-keys/ which i have understood for most part but i get stuck e.g (A B C D E F) A B → C D E B C D → A B C E → A D B D → E right as far as i understand from the link i know you find the common sets from the left which is only B, and common sets from the right which are none now where do i go from here? i know all candidate sets will have B in

Definition of 3NF

柔情痞子 提交于 2019-12-24 08:24:09
问题 I'm rather confused about the definition of 3NF. Let R be a relation with attribute set X. Suppose Y -> A is a functional dependency where A is a non-prime attribute and Y is a subset of X. If Y is a proper subset of any candidate key for R, then the relation is not in 3NF (and not even in 2NF) because this is a partial dependency, which is not permitted in 2NF (and by extension 3NF). If Y is a non-prime attribute, the relation is not in 3NF because this is a transitive dependency of the non

1NF: Repeating Groups, what are they? [duplicate]

半世苍凉 提交于 2019-12-24 07:25:15
问题 This question already has answers here : Normalization: What does “repeating groups” mean? (2 answers) Closed 5 years ago . There seems to be a misconception on what is a 'repeating group', in terms of its removal in 1st Normal Form (1NF), could any one clearly clarify what it actually is and how to identify one? The misconception, I found, is discussed further here: https://stackoverflow.com/a/23202535/4011506. However, that has further confused me. In regards to the following video (4:30

Pony ORM Entity Unidirectional Mapping gives an error

守給你的承諾、 提交于 2019-12-24 05:49:43
问题 I have 2 tables. TableA & TableB TableA +------+----------------+-----------+ | id | some_attribute | tableB_id | +------+----------------+-----------+ id =primary key some_attribute =varchar TableB_id =foreign key TableB +------+----------------+ | id | some_attribute | +------+----------------+ id =primary key some_attribute =varchar My code: # establish a connection with the database (MySQL) db = Connection.Connection.connect_db_server_default() class TableB(db.Entity): _table_ = "table_b"

Is it practical to dynamically normalize a table?

只愿长相守 提交于 2019-12-23 18:19:32
问题 Let's say my database tracks bird sightings (Note: I'm really scraping the bottom of the barrel for examples). The fields are: sighting_id | common_name | park_name | location | time | etc.... Although I'm assuming that a park will always be in the same location, the website is like a spreadsheet. The user enters park_name and location for every entry. Also please note that my actual schema has other fields that are dependent on the analogous "park name" as well (e.g. state). I do not have a

Normal Form - 4th Normal Form

江枫思渺然 提交于 2019-12-23 06:10:22
问题 I have this data that I need to put into 3rd and 4th Normal Form. I understand the basics of normal form but I'm confused with 3rd and 4th normal form and I've checked online but still don't understand. I'm creating a database which is being used by my system. 回答1: A relation in 4NF is also in BCNF, 3NF and the lower NFs. From this answer: A superkey is a set of columns that uniquely identifies rows. A candidate key is a set of columns that uniquely identifies rows and that contains no