Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23
DATABASE SYSTEMS
Lecturer: Muhammad Tajmal
Email: [email protected] Three Level Architecture: External Level Conceptual Level Internal or Physical Level THREE LEVEL ARCHITECTURE 1) External Level At is also called view level. The reason this level is called "view" is because several users can view their desired data from this level which is internally fetched from database with the help of conceptual and internal level mapping. The user doesn't need to know the database schema details such as data structure, table definition etc. user is only concerned about data which is what returned back to the view level after it has been fetched from database (present at the internal level). External level is the "top level" of the Three Level DBMS Architecture. 2) Conceptual Level It is also called logical level. The whole design of the database such as relationship among data, schema of data etc. are described in this level. Database constraints and security are also implemented in this level of architecture. This level is maintained by DBA (database administrator). 3) Internal Level This level is also known as physical level. This level describes how the data is actually stored in the storage devices. This level is also responsible for allocating space to the data. This is the lowest level of the architecture. Mapping in Three-Level Architecture What is Mapping From the Conceptual level to the Internal level From the External level to the Conceptual level Mapping: Mapping is the process of converting one level to another level. In this process, the data at one level is related to the data at another level. There are two levels of mapping: From the conceptual level to the internal level From the external level to the conceptual level Conceptual / Internal Mapping The conceptual/internal mapping defines the correspondence between the conceptual view and the stored database. It specifies how conceptual records and fields are represented at the internal level. If the structure of the stored database is changed, then the conceptual/internal mapping must be changed accordingly so that the conceptual schema can remain consistent it is the responsibility of DBA to manage such change. External / Conceptual Mapping An external/conceptual mapping defines the correspondence between a particular external view and a conceptual view generally the difference between these two levels are similar to the difference between a conceptual view and a stored database. For example, fields can have different data type fields and record name can be changed, several conceptual fields can be combined into a single field any number of external view views a can exist at the same time any number of users can share a given external view and different external views can overlap each other. Data Independence in 3 Level Architecture: 1) Logical data independence: Ability to modify the conceptual schema without changing the external schema or application program 2) Physical data independence : Ability to modify the internal schema without changing the conceptual schema. Data Models: A representation of real-world objects, events, and their associations is called a model. The model helps the user to understand the complexities of the real- world environment. A collection of concepts to describe and manipulate data relationships between data and constraints on data is called a data model. Parts of the Data Model: A data model consists of the following parts: Structural part: It consists of a set of rules. These rules specify how a database can be developed. Manipulative part: It defines the types of operations that can be performed on data. The operations include updating or retrieving data from a database and changing the structure of a database. Set of integrity rules: It ensures the accuracy of data in the database. Importance of Data Model: The data model is used as a communication tool for database designers, application programmers, and end-user to interact with one another. A good data model enables the users to understand the organization for which the database design is developed a good data model is very necessary to design a good database. Any DBMS is based on a specific data model. No DBMS can exist without any data model. It is difficult to create a proper database without knowing the data model of dreams. It is very important to know the structures, Manipulation languages and integrity facilities implemented Prior to DBMS. It enables the user to understand the facilities and functionalities provided by the DBMS. Types of Data Models Object-Based Data Models Record-Based Data Models I. The Hierarchical Model II. The Network Model III. The Relational Model Physical Data Model Object-based data models and record-based data models are used to describe data at conceptual and external levels. The physical data models are used to describe data at the Internal level. Object-Based Data Models Object-based data models use the concepts like entities, attributes and relationships. An entity is a person, place, thing or event for which data is collected and maintained in the database. An attribute is the characteristics of an entity. A relationship is an association between two or more entities. Some types of object-based data models are as follows: 1. Entity-relationship 2. Semantic 3. Object-Oriented etc. Record-Based Data Models Record-based models are basically used to describe external and conceptual levels of databases. They can also be used to describe internal level to some extent. They are used to develop and specify the logical structure and provide some options for the implementation of the design. In record-based data models, a database consists of different records. The records may be of different types. Each record type defines a fixed number of fields. There are three types of record-based data models • The Hierarchical Model • The Network Model • The Relational Model Hierarchical Model One of the earliest database management systems was based on a hierarchical model. In this model, records have a parent-child relationship. One of the most popular hierarchical database management systems was Information Management System (IMS). It was introduced by IBM in 1968. IMS is still the most widely used DBMS on IBM mainframes. Consider the application used for production planning in automobile manufacturing companies. The model of the database is shown in the following figure. The automobile manufacturer produces various models of cars. Each car model is decomposed into assemblies like Engine, Body, and Chassis. Each assembly is further decomposed into sub-assemblies like valves, spark plugs, and so on. If the manufacturer wants to guarantee the bill of materials for a particular model of an automobile, the hierarchical data model is suitable because the bill of materials for a product has a hierarchical structure. Each record represents a particular part. Since the records have a parent-child relationship, each part is linked to its sub-part. Characteristics of Hierarchical Model The characteristics of a hierarchical DBMS are as follows: 1. Representation of Data as hierarchical trees The hierarchical database is characterized by parent-child relationships between records. A record type RI is called the parent of record type R2 if RI is I level higher than R2 is the hierarchical tree. The root of the hierarchy is the most important record type. All records at different levels of the hierarchy are dependent on the root. 2. Each Sub-Module has only one Super-Module Each child record (submodule )has only one parent record (super-module). The parent record can have one or more children's record types. 3. Represents a set of Related records There can be one or more record occurrences for a given record type. When the user writes into the database, only one occurrence of a record type is written. Similarly, when a record is retrieved from a database, only one occurrence of a record type is retrieved. 4. Hierarchy through pointers In a hierarchical database, pointers are used to link the records. Pointers determine whether a particular record occurrence is a parent or a child record. The path from the parent to the child is maintained through pointers. 5. Simple Structure The database is a Simple hierarchical tree. The parent and child records are stored close to each other on the disk. It minimizes disk input and output. 6. High Performance The parent-child relationship is stored as pointers from one record to another. The navigation through the database is very fast resulting in high performance. 7. Predefined relationships between record types Record types at different levels of the hierarchy are dependent on the root. The root is the most important record type in the hierarchy. 8. Difficult to Reorganize It is difficult to reorganize the database because the hierarchy has to be maintained. Each time a record type is inserted or deleted, the pointers have to be manipulated to maintain the parent-child relationship. 9. More Complex Real-Life Requirements The hierarchical DBMS is based on a simple parent-child relationship. The real-life applications are more complex and cannot be represented by a hierarchical structure. For example, in an order processing database, a single order might participate in three different parent-child relationships. It may link the order to a customer who placed the order, the items ordered and the salesperson who took the order. This complex structure cannot be represented in a hierarchical structure. Thank s