8.2 Database Management Systems (DBMS) (3)
Resources |
Revision Questions |
Computer Science
Login to see all questions
Click on a question to view the answer
1.
Describe the limitations of a file-based approach to data management. Then, explain how a Database Management System (DBMS) addresses these limitations, specifically highlighting the benefits of data integrity and data consistency.
A file-based approach to data management stores data in separate files. This method suffers from several limitations:
- Data Redundancy: Data may be duplicated across multiple files, leading to wasted storage space and inconsistencies.
- Data Inconsistency: Updates to data in one file may not be reflected in other files, resulting in conflicting information.
- Difficult Data Access: Accessing specific data requires complex programs to be written, and data retrieval can be slow.
- Data Integrity Issues: Lack of enforced constraints can lead to invalid or inconsistent data being stored.
- Security Issues: Protecting data can be challenging as there is no central control over access.
A DBMS addresses these limitations through several key features:
- Data Integrity Constraints: DBMSs allow defining constraints (e.g., primary keys, foreign keys, data types) to ensure data accuracy and consistency. This prevents invalid data from being entered.
- Data Consistency: DBMSs enforce rules to maintain data consistency across the entire database. Transactions ensure that a series of operations are treated as a single unit, either all succeeding or all failing, preventing partial updates.
- Efficient Data Access: DBMSs provide query languages (e.g., SQL) and indexing mechanisms for fast and efficient data retrieval.
- Centralized Data Management: A DBMS provides a central point of control for managing data, improving security and access control.
- Reduced Data Redundancy: Normalization techniques are used to reduce data redundancy and improve data integrity.
2.
Explain the purpose of a relational model in a DBMS. Illustrate your answer using a simple example of a database for a library, including the tables involved and the relationships between them. Show how the relational model helps to avoid data redundancy.
The relational model is the foundation of most modern DBMSs. It organizes data into tables, which consist of rows (representing individual records) and columns (representing attributes). The relationships between tables are established through keys, typically primary and foreign keys. The relational model aims to represent real-world entities and their relationships in a structured and logical way.
Consider a library database. We can represent the following entities:
- Books: Contains information about each book (e.g., book_id, title, author, ISBN).
- Members: Contains information about library members (e.g., member_id, name, address).
- Loans: Records which books are loaned to which members (e.g., loanid, bookid, memberid, loandate, due_date).
Here's a simple representation of the tables:
Books Table:
book_id (PK) | title | author | ISBN |
Members Table:
member_id (PK) | name | address |
Loans Table:
loanid (PK) | bookid (FK) | memberid (FK) | loandate | due_date |
The use of foreign keys (e.g., bookid in the Loans table referencing the Books table, and memberid referencing the Members table) ensures that relationships between entities are maintained. This avoids data redundancy. For example, the book's title and author are stored only once in the Books table, and the Loans table simply references the book's book_id. Without the relational model, the book's title and author might be repeated in every loan record, leading to wasted space and potential inconsistencies if the title or author changes.
3.
Compare and contrast the advantages and disadvantages of using an hierarchical database model and a network database model in a DBMS. How do these models differ from the more flexible relational model?
Hierarchical and Network Models: These were early database models that were prevalent before the relational model gained popularity. They organize data in a tree-like (hierarchical) or graph-like (network) structure.
Hierarchical Model:
- Advantages: Simple to understand and implement. Efficient for representing one-to-many relationships (e.g., a company has many employees).
- Disadvantages: Inflexible; difficult to represent many-to-many relationships. Data redundancy can be an issue. Modifying the structure can be complex.
Network Model:
- Advantages: More flexible than the hierarchical model; can represent many-to-many relationships.
- Disadvantages: Complex to design and implement. Difficult to navigate and maintain. Data redundancy can still be a problem.
Comparison with the Relational Model:
The relational model differs significantly from the hierarchical and network models in the following ways:
- Flexibility: The relational model is much more flexible than the hierarchical and network models. It allows for complex queries and data manipulation.
- Data Redundancy: The relational model minimizes data redundancy through normalization. The hierarchical and network models often have significant data redundancy.
- Ease of Use: The relational model uses SQL, a standardized query language, which is easier to learn and use than the navigation languages used in hierarchical and network models.
- Data Independence: The relational model provides better data independence, meaning that changes to the database structure have less impact on applications.
In summary, while hierarchical and network models were important steps in database development, the relational model's flexibility, data integrity features, and ease of use have made it the dominant model in modern DBMSs.