View of Data | Data Abstraction | Instances and Schema in DBMS



View of Data

The system hides certain details of how the data are stored and maintained and such view is an abstract view.
The Database System provides users with an abstract view of the data.


Data Abstraction

The database designers use the complex data structure to represent the data in the database and developer hides the complexity from user from several level of abstraction such as physical level, logical level, and view level. This process is called data abstraction.

Levels of Data Abstraction

The three levels of data abstraction can be shown as follows
 
Different levels of data abstraction
(Fig: Different levels of data abstraction)


Physical level

  • It is the lowest level of abstractions describes how the data are actually stored.
  • The physical level describes complex low-level data structure in details.
  • At this level records such as customer, account can be described as a block of consecutive storage location (e.g. byte, word)
  • The database system hides many of the lowest level storage details from database programmer. Database administrator may be aware of certain details of the physical organization of the data.


Logical level

  • It is the next higher level of data abstraction which describes what data are stored in the database, and what relationships exist among those data.
  • At the logical level, each record is described by a type definition
  • Programmers and database administrator work at this level of abstraction.


View level

  • It is the highest level of abstraction describes only a part of the database and hides some information to the user.
  • At view level, computer users see a set of application programs that hide details of data types. Similarly, at the view level several views of the database are defined and database user sees only these views.
  • Views also provides the security mechanism to prevent users from accessing certain parts of the database (that is views can also hide information (such as an employee ‘s salary) for security purposes.)


Instances and Schema

Instance (Database State)

The collection of information stored in the database at a particular moment is called an instance of the database. It is the actual content of the database at a particular point in time
  • The analogous to the value of a variable in a program
  • The actual data stored in a database at a particular moment in time. This includes the collection of all the data in the database.
  • Also called database instance (or occurrence or snapshot).
  • The term instance is also applied to individual database components, e.g. record instance, table instance, entity instance

Initial Database State

  • Refers to the database state when it is initially loaded into the system.

Valid State

  • A state that satisfies the structure and constraints of the database.

Schema 

The overall design of the database is called database schema. Simply, the database schema is the logical structure of the database  
  • The concept of database schema and instances can be understood by analogy to a program written in a programming language 
  • A database schema corresponds to the variable declaration and the values of the variables in a program at a point in time correspond to an instance of a database.
  • Example: The database consists of information about a set of customers and accounts and the relationship between them
  • The database systems have several schema and partitioned according to the level of abstraction such as physical and logical schema  
Schema diagram for the database

Schema diagram for the database



Database State Vs. Schema
  • The database schema changes very infrequently. 
  • The database state changes every time the database is updated. 
  • Schema is also called intention.
  • State is also called extension.


Physical and Logical Schema
  • Physical schema: The physical schema describes the database design at the physical level. The physical schema is hidden beneath the logical schema, and can usually be changed easily without affecting application program
  • Logical schema: The logical schema describes the database design at the logical level. Database design at the logical level. Programmer construct the application using logical schema.
  • Sub schema: The database system may also have several schema at the view level such schema are called sub schema that describe different views of the database.



Three-Schema Architecture

The goal of three-schema architecture goal is to separate the user applications and the physical database.
Not explicitly used in commercial DBMS products, but has been useful in explaining database system organization

Defines DBMS schemas at three levels:

Internal schema at the internal level to describe physical storage structures and access paths (e.g indexes).
  • Typically uses a physical data model.

Conceptual schema at the conceptual level to describe the structure and constraints for the whole database for a community of users. 
  • Uses a conceptual or an implementation data model.

External schemas at the external level (or view level) to describe the various user views. 
  • Usually uses the same data model as the conceptual schema.

The Three Schema Architecture

The Three Schema Architecture


Mappings among schema levels are needed to transform requests and data. 
  • Programs refer to an external schema, and are mapped by the DBMS to the internal schema for execution.
  • Data extracted from the internal DBMS level is reformatted to match the user‘s external view (e.g. formatting the results of an SQL query for display in a Web page)


Comments

Popular posts from this blog

C Program for SCAN Disk Scheduling Algorithm | C Programming

C program to Find Cartesian Product of Two Sets | C programming

C Program To Check The String Is Valid Identifier Or Not | C Programming