University › Software and Informatics › Database Systems
Database Concepts and Architecture
Distinguish data, database and database management system, and explain the role of each in a simple usage scenario. Three-schema architecture.
Learning Outcomes
- Can distinguish between the concepts of data, database and database management system and explain the role of each in a simple usage scenario.
- By drawing the three-layer schema architecture, it can determine under which changes physical and logical data independence is preserved.
- Can compare the effects of a definition language expression and a data query using the distinction between schema and instance.
- It can list the basic components of the database system and explain the flow of a query between these components.
Topic Explanation
Data, database and database management system
Data are recorded traces of real-world phenomena; It has no meaning on its own, but turns into information when interpreted in context. Although a student's number, courses taken and grades are separate records, when evaluated together, they allow us to talk about the academic status of that student. A database is a persistent and accessible collection of such related data organized for a specific purpose. Persistence means that data exists after the program ends; Regularity means that the records follow a defined structure rather than being stacked randomly.
The database management system is the software layer that creates, queries, updates and maintains this collection. Instead of opening the file directly, the user sends a request to the system; The system interprets the request, accesses the data, and returns the result. This interface makes it possible for multiple users to access the same data simultaneously, separate privileges and apply restrictions. Without the system, each application would have to rewrite its own file format and access code and apply common rules on its own.
Problems of the file-based approach
In the early days, data was kept in special files of applications. The same student record existed in both the registration file and the grade file, and when the address changed, both files had to be updated. Failure to update one was still causing inconsistency. This is called data duplication and its corollary, inconsistency. Replication produces multiple copies of the same fact; The difference between copies raises the question of which value the system will believe.
In the file-based approach, data and the program that uses it are tightly interconnected. When the file's field order is changed, any program that reads it must also be changed; This is called data dependency. Additionally, it is necessary to write a special program to run a specific query; it is not practically possible to ask a new question on existing data. The database approach solves these problems with a single common data definition, centralized constraint management, and general-purpose query interface.
Three-schema architecture
In conceptual design, it is assumed that data is defined at three different levels. The external level is the partial view that the user sees; A department manager only sees records belonging to his or her department. The conceptual level is the overall logical structure of the data; It describes which entities, which relationships, and which constraints. The internal level describes how data is located in storage units, how records are arranged, and what access paths are established.
Mapping transformations between layers are kept within the system. Because a user is working through the skin, their query remains the same even if the underlying storage layout changes. For example, when the order of the records is changed, the field names and relationships presented to the user do not change. This distinction also allows the same conceptual data to be presented in different views to different user groups; each group sees only the areas they need to see.
Physical and logical data independence
Physical data independence means that changes in the storage structure do not affect the conceptual schema. Adding indexes, moving records to a different block layout, or changing the compression method does not change user calls. Logical data independence means that the change in the conceptual scheme does not affect external views as much as possible; Adding a new field will not break most applications.
These two independences are the most important architectural achievement of the database system. The application code does not know where the data resides or through what access it is available; It only works with logical names. Thus, maintenance costs decrease and schema development becomes safer. However, independence is not unlimited: when a field is renamed or removed, the views that reference it have to be updated.
Data models and model selection
A data model is a conceptual framework that defines how data will be structured and what operations will be allowed. The hierarchical model organizes the data in a tree form; Each child has only one top. The network model allows a record to have multiple exponents. The relational model describes data with relationships consisting of rows and columns and is based on a mathematical basis.
The objective approach attempts to model data with classes and objects; Represents complex types more directly. Today, the relational model has found wide use thanks to its simplicity and powerful query infrastructure. Model selection depends on the application's data structure, query diversity, and consistency expectation. Choosing the wrong model makes future schema changes and query writing unduly difficult.
Schema, instance and data dictionary
Schema is a set of definitions that describe the structure of the database; It tells you which relationships, which columns, which types, and which constraints exist. Sample is the value of the data suitable for the schema at a certain moment. This distinction is similar to the difference between a program's type definition and that program's current variable values. The schema is relatively fixed, while the instance changes with each update.
The data dictionary is a record of schema information maintained by the system itself. Column names, data types, constraints, user privileges and view definitions are stored here. When processing a request, the query processor first consults the dictionary; It checks whether the field exists, its type and the user's authority from this record. Centralization of the dictionary ensures that the same definition is used consistently for all users.
Core components of a database system
A database system consists of several subunits. The query processor parses the incoming request, validates it with the dictionary, and decides how to find the data. The execution engine implements this decision; The storage manager reads or writes data from volumes on disk. The buffer manager reduces disk access by keeping frequently used blocks of data in memory.
The process manager ensures that multiple processes do not disrupt each other when running simultaneously; The log manager saves changes and allows undoing or fast-forwarding as needed. Although these components appear independent of each other, they collaborate through a common dictionary and a common log. A failure in one component can affect the behavior of others; Therefore, it is necessary to consider the system as a whole.
Users, languages and design goals
Database users work at different levels. The end user enters and queries data via ready-made views; The application developer connects these views to their programs. The database administrator sets up the schema, distributes privileges, backups and monitors performance. The designer establishes the conceptual structure of the data and transforms the requirements into a model.
The definition language covers creating and changing the schema, the manipulation language covers adding and querying data, and the control language covers granting and retrieving authorization. The goals of a good design are accuracy, consistency, performance, security and maintainability. These goals may conflict with each other: tight constraints may increase accuracy but reduce typing speed. The design must be balanced against the priorities of the application.
Key Points
- Database, organized and persistent collection of related data; The management system is the software layer that manages access to it.
- The external, conceptual and internal schema layers accommodate different user views and a single logical structure.
- Physical independence hides storage changes, logical independence hides schema changes from the user.
- The schema is the value of the structure, the example of the data suitable for that schema, at a certain moment; The data dictionary keeps the schema within the system.
Worked Examples
Worked Example
Worked Example
Worked Example
Worked Example
Common Mistakes
- Thinking that database and database management system are the same thing; mixing data with the software that manages it.
- Mistaking the internal schema for the list of fields visible to the user and confusing it with the conceptual schema.
- Equating the schema with the data itself and assuming that the structure changes with each update.
- Assuming independence is absolute and assuming that a domain name change will not affect existing queries.
Tips
- Keep the number of layers in mind as follows: user sees, system interprets, storage moves.
- Data duplication is not an error per se; Inconsistency occurs when copies diverge from each other.
- Adding an index does not change the skin; This is the epitome of physical independence.
- Logical independence is not unlimited; Views that use a removed field must be updated.
Practice Questions
- 1. Which of the following definitions belongs to the concept of database?
- 2. What concept does this definition describe: It is a permanent and accessible collection of related data organized for a specific purpose.
- 3. Which of the following definitions belongs to the concept of database management system?
- 4. What concept does this definition describe? It is the software layer that creates, queries, updates and protects data.
- 5. Which of the following definitions belongs to the concept of schema?
- 6. What concept does this definition describe? It is a structural description that includes definitions of relationships, fields, types and constraints.
- 7. Which of the following definitions belongs to the concept of example?
- 8. What concept does this definition describe: It is the set of values of the data suitable for the schema at a certain moment.
- 9. Which of the following definitions belongs to the concept of external schema?
- 10. What concept does this definition describe: It is a partial data view presented to a user or group of users.
- 11. Which of the following definitions belongs to the concept of conceptual schema?
- 12. What concept does this definition describe? It is the definition that describes the holistic logical structure and constraints of the data.
- 13. Which of the following definitions belongs to the concept of internal schema?
- 14. What concept does this definition describe? It is the physical definition that explains how data is located in storage units.
- 15. Which of the following definitions belongs to the concept of physical data independence?
- 16. What concept does this definition describe: The conceptual scheme is not affected when the storage structure changes.
- VOLUME 17 Which of the following definitions belongs to the concept of logical data independence?
- 18. What concept does this definition describe: When the conceptual scheme changes, external appearances are not affected as much as possible.
- 19. Which of the following definitions belongs to the concept of data dictionary?
- 20. What concept does this definition describe: It is the record that stores schema information, field definitions and authorizations in the system.
- 21. Which of the following definitions belongs to the concept of data model?
- 22. What concept does this definition describe: It is the framework that defines how the data will be structured and what operations will be allowed.
- 23. Which of the following definitions belongs to the concept of description language?
- 24. What concept does this definition describe? It is the language part that performs the operations of creating, changing and removing the schema.
- 25. What is the correct answer to the solved example? A student record contains name, number and department fields. The same name also appears in another record. Is this a data duplication, how can it be distinguished?
- 26 What is the correct answer to the solved example? Does the result of the user query change when the order of the records on the disk is changed? Explain.
- 27 What is the correct answer to the solved example? Does adding a new column to a view violate logical data independence?
- 28 What is the correct answer to the solved example? In one institution, the same student number is kept in two different files and the name in one of them is not updated. What problem occurs?
- 29 What is the correct answer to the solved example? Which record does the query processor reference first when it receives a SELECT request and why?
- 30 Which of the following options is the layer mapping relationship expression?
- 31 Which of the following options is the data duplication inconsistency condition expression?
- 32 Which of the following options is the scope of independence expression?
- 33 Which of the following options is the schema-instance relationship expression?
- 34 Which modification preserves physical independence?
- 35 What is the problem that arises when two copies of the same fact have different values?
- 36 Which layer ensures that a user can only see the records in his/her own section?
- 37 Which component validates the query's field names?
- 38 What is the relationship between the schema and the example?
- 39 What is the main constraint of the hierarchical data model?
- 40 Adding a new column is an example of which type of independence?
- 41 What benefit does using a central data dictionary provide?
Source: Inspired by open curricula of Turkish universities; the explanation is written originally.
Kaynak: Türkiye üniversitelerinin açık ders planlarından esinlenilmiştir; anlatım özgün olarak yazılmıştır.