Redundancy and Inconsistence in Relational DB

  • Thread starter WWGD
  • Start date
  • Tags
    Db
In summary, redundancies may lead to inconsistencies in a relational table if there is a duplication of a field in different records.
  • #1
WWGD
Science Advisor
Gold Member
7,031
10,618
Hi All,
I am given this relational table

ROOM (RoomID, BuildingName, FloorNumber, NumberOfFloors).
The underline and bold mean that RoomID is the primary key.

And I am asked to show an example of how redundancies may result in inconsistencies.

This is a questions someone asked, hoping for my help, but I am stuck.

So I am not even sure of what to do. I am looking for an example, a "model" where one or more
entries are repeated which leads to inconsistencies. I am assuming for now that just one repetition
will do, so I set up a table with a repeated entry (please see attached file). I chose rooms in buildings
with the same number of rooms and same floor number.
Any ideas?
 

Attachments

  • RoomID.docx
    11.5 KB · Views: 264
  • Like
Likes Silicon Waffle
Computer science news on Phys.org
  • #2
What do you think of numberoffloors ? Does it depend on the primary key ?
 
  • Like
Likes WWGD
  • #3
Ah, thanks, I am not just clear on what we need to do. So we may have two identical records. Then we mistakenly enter different PK entries, which we can do, since, , as you pointed out, PK does not determine numberoffloors (I know this is ambiguous, what I mean is different rooms may be in different buildings with the same number of floors), and this gives us an inconsistency. So, if we mistakenly enter "Number of Floors" with a different value in the same copy, we have no way of automatically telling this is wrong?
 

Attachments

  • RoomID.docx
    11.6 KB · Views: 261
  • #4
Hi WW,

Sorry, I didn't bother to look at the word file before replying to post #1: the table definition was enough to reply as I did.

My reply was triggered by the fact that #floors appears in every record for a given building, so in the normalization process it should turn out to be an attribute for the building, not for the room.
In the design of the table, it's more a redundancy issue than an inconsistency issue.
In a design redundancy is to be avoided, because inconsistency can arise easily when you add a record like (8, 1, 3, 4) (*)

For the word file in post #1, I would say adding record 2 will already be disallowed because the primary key must be unique. Same for the second word file in post #3.

(*) Which is what you pointed at in the second word file in post #3, but somewhat obfuscated because of the identical PK.

And yes, sometimes we do leave redundancies in and make sure inconsistencies are prevented by triggering checking procedures (which slows down the process, but less than splitting off a separate table with its own overhead). But in the learning process we don't ...:smile:

Redundancies are a sure recipe for future trouble: in your example, adding a floor to a building forces having to go through all records and fix them.
 
Last edited:
  • Like
Likes Silicon Waffle
  • #5
Do you reference multiple copies of the same record and or field?

Redundancy means that you have more than the minimum required information to represent something. Do you store the same field twice or more and do you store more than the number of references you should (and is the choice of primary key structure optimal in that regard as well)?
 

Related to Redundancy and Inconsistence in Relational DB

1. What is redundancy in a relational database?

Redundancy in a relational database refers to the duplication of data within the database. This means that the same data is stored in multiple places, which can lead to data inconsistency and inefficiency.

2. How does redundancy affect data consistency?

Redundancy can lead to data inconsistency because if the same data is stored in multiple places, any updates or changes to that data may not be reflected in all locations. This can result in conflicting or incorrect information within the database.

3. What are some common examples of redundancy in a relational database?

Some common examples of redundancy in a relational database include storing the same customer information in multiple tables, or having duplicate records for the same product in different tables. Another example is storing the same data in both numeric and text formats.

4. How can redundancy be minimized in a relational database?

One way to minimize redundancy in a relational database is through normalization, which involves organizing data into multiple tables and establishing relationships between them. This helps reduce the amount of duplicated data and ensures data consistency.

5. What are the potential consequences of not addressing redundancy and inconsistency in a relational database?

If redundancy and inconsistency are not addressed in a relational database, it can lead to data integrity issues, incorrect or outdated information, and inefficient use of storage space. This can also make it difficult to retrieve accurate information and can negatively impact the overall performance of the database.

Similar threads

Replies
9
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
669
Replies
2
Views
737
  • Sci-Fi Writing and World Building
2
Replies
48
Views
4K
  • Programming and Computer Science
Replies
6
Views
1K
  • General Discussion
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
Replies
40
Views
7K
Replies
3
Views
1K
  • Feedback and Announcements
Replies
1
Views
544
Back
Top