database-normalization

BCNF: Looking for example that actually uses superkey instead of candidate key

落花浮王杯 提交于 2019-12-02 04:14:39
The definition of the Boyce–Codd normal form states that the determinants of all non-trivial functional dependencies have to be superkeys. All the examples for relations in BCNF I found make use of candidate keys. I am looking for an example that actually has a superkey as determinant which is not a candidate key. I fail to come up with a relation that only uses superkeys which can't be transformed to use candidate keys. Let's say we have a relation with an candidate key and an additional functional dependency with a superkey as determinant. R1(A,B,C) {A} A,B -> C This additional FD is

Which highest normal form is this table in?

瘦欲@ 提交于 2019-12-02 01:01:35
Ticket Vname Nname 1 Oli Seitz 1 Andi Hofmann 2 Oli Seitz 2 Oli Schmidt 2 Tim Schmidt 3 Tim Hofmann This table represents a mapping of persons ( Vname, Nname ) and tickets ( Ticket ). Vname and Nname together identify a person, but every Person ( Vname, Nname ) can have multiple tickets ( Ticket ), and a ticket can be assigned to multiple people. The PK in this table are all three columns together. So this table should be 1NF because there is no multi dimensional data in one column. But then I struggle. I think it is 2NF and 3NF because I can´t find any functional dependencies. (Hope they are

How do I know which is the more appropriate database design? (Authors, Articles & Comments)

不打扰是莪最后的温柔 提交于 2019-12-01 14:55:42
Let's assume a database with three tables: Author , Articles , Comments Assuming the relationship is as follows: Author has many Articles Article belongs to one Author Article has many Comments Comment belongs to one Article If I want to know which Author writes the most commented article, I need to select all Articles that belong to a specific Author first. Then I can count the number of comments that were posted under each of those articles. Which in general leads to more complex queries. If The relationships were as follows: Author has many Articles Article belongs to one Author Article has

Break atomicity rule storing list of items when there is no reason to query about items? Verses join table that requires whole join table be scanned

社会主义新天地 提交于 2019-12-01 14:42:47
This specific case is regarding lists, and items. The same item may belong to multiple lists, and each list has many items. Option A (the "proper" way as I understand it): Make a join table, which has list_ID and item_ID. When I want all the items in a list query for list_ID. Option B (break the atomicity rule): Make a list table. Primary Key, and either repeating columns or non-atomic columns. As I understand it both of these deviations suffer the exact same drawbacks, which is the inability to inefficiently query on items. As I understand it, normalizing a database to NF-1 would be making

Which database design gives better performance?

旧街凉风 提交于 2019-12-01 13:32:52
问题 I want to select to retrieve person and also further make some inserts, deletes and updates. If I want retrieve person who lives in Brazil what will be the best approach? Make 2 foreign key city and country in table person : Person(id, name, profession, **id_country**, **id_city**) cities (id, city, **id_country**) countries (id, country) or just one foreign key of cities in table person and a other foreign key county in table cities Person(id, name, profession, **id_city**) cities (id, city,

Determining if a relation is 1NF with no data

白昼怎懂夜的黑 提交于 2019-12-01 13:24:36
问题 I have a relation CAR_SALE(Car#, Date_sold, Salesperson#, Commission%, Discount_amt) Primary Key: {Car#, Salesperson#} Additional Dependencies: Date_sold -> Discount_amt Salesperson# -> Commission% and I have to determine if it is in 1NF, 2NF, or 3NF. We are only given the relation schema with no data. I am having trouble determining if this is in 1NF. In order for something to be in 1NF, it must not have repeating groups for an attribute. Given this relation schema with no actual data,

How do I know which is the more appropriate database design? (Authors, Articles & Comments)

百般思念 提交于 2019-12-01 13:15:59
问题 Let's assume a database with three tables: Author , Articles , Comments Assuming the relationship is as follows: Author has many Articles Article belongs to one Author Article has many Comments Comment belongs to one Article If I want to know which Author writes the most commented article, I need to select all Articles that belong to a specific Author first. Then I can count the number of comments that were posted under each of those articles. Which in general leads to more complex queries.

Cross Table Dependency/Constraint in SQL Database

对着背影说爱祢 提交于 2019-12-01 11:55:38
Take the example that I have of a table called classes that holds university classes and a table called students that holds students. A class has many students and a student can only take one class. (1 to many relationship). If I had a column in classes that stored the total number of students a class has, this feels like it should violate 3NF. But the dependency is in a separate table. What is this dependency called? And can we say this is violating 3NF? Because in some sense it has all the problems of a 3NF violation. I was wondering if this was a related case. TL;DR But the dependency is in

Cross Table Dependency/Constraint in SQL Database

折月煮酒 提交于 2019-12-01 08:15:59
问题 Take the example that I have of a table called classes that holds university classes and a table called students that holds students. A class has many students and a student can only take one class. (1 to many relationship). If I had a column in classes that stored the total number of students a class has, this feels like it should violate 3NF. But the dependency is in a separate table. What is this dependency called? And can we say this is violating 3NF? Because in some sense it has all the

Is a fact table in normalized or de-normalized form?

删除回忆录丶 提交于 2019-12-01 03:42:34
I did a bit R&D on the fact tables, whether they are normalized or de-normalized. I came across some findings which make me confused. According to Kimball : Dimensional models combine normalized and denormalized table structures. The dimension tables of descriptive information are highly denormalized with detailed and hierarchical roll-up attributes in the same table. Meanwhile, the fact tables with performance metrics are typically normalized. While we advise against a fully normalized with snowflaked dimension attributes in separate tables (creating blizzard-like conditions for the business