Tuesday, March 29, 2011

View of Data, Schemas & Instances, and Data Models ,DBMS-II

View of Data, Schemas & Instances and Data Models

DBMS is a collection of interrelated data and a set of programs that allow users to access and modify the interrelated data. The major purpose of DBMS using DBMS is providing an abstract view of the data is the major purpose of DBMS. Data must be retrieved efficiently from the systems in order the system to be usable. This has led the designers to use complex data structures for data representation in the database. Complexity of the development is hidden from the users who use the database using the concept of abstraction. The purpose of using such abstraction is to simply user’s e interaction with the system.
There are three levels of abstractions. They are
Physical level: Lowest level and describes how the data are actually stored. It describes in detail what complex data structures are needed to store the data on disk.
Logical Level:  This is the middle level of abstraction. Its purpose is to describe what data are stored in the database and what relationships exist among those data. This level describe the entire database in simple structure. Of course each simple structure at logical level may use complex physical level structures. Users who use logical level need not worry about or need not know about this representation of physical structure. Generally what information need to put in the database is decided by administrators using this logical level.   
The ability to change scheme definition at one level without changing schema definition at the next higher level is termed as Data Independence.
Logical data independence:  The ability to change scheme  definition conceptual level  without changing the scheme definition at the view level is termed as logical data independence. 
Physical data independence: The ability to change scheme definition at physical level without changing the scheme definition at the conceptual level is termed as physical data independence.
View level:  This is the highest level of abstraction used to describe only small part of the database.  Most of the users who use the database need to know only  part of the database only. This abstraction simplifies the  user’s interaction with the system .  That means  view describes only part of the data at logical level. Also different views for different users possible for same database.  For example,    Student address not visible to person computing grades based on the marks secured in different tests.  So here the address of the student is not important in deciding grades.
Instance and schema : A collection of information  stored in the database at a particular point in time is termed as an Instance of the database. The complete design of the database is called the database schema. Changes in schema is very rarely changed and it is more or less permanent whereas the instance of the database schema change when new information is added or deleted.  Database system can  several schemas, partitioned into levels of abstraction.
Data Models: The logical model is the heart of the database. The logical model is the heart of the database. A good logical design is easy to implement and supports the desired external views. Using data model, we can describe the design of database at all three levels, namely, physical, conceptual and logical levels.
 Relational, network and hierarchical data models belong to record based kind. ER model is of semantic data model. Hierarchical data model uses the a tree structure to hold data in its nodes or segments. Each occurrence of the structure begins with the root node. The entire database extension consists of multiple occurrences of the tree each of which starts with an occurrence of the root node.
The network model uses a network or plex structure which consists of nodes and branches. Unlike a tree a network allows a node to have more than one parent or owner node o which it is dependent. Pointers are used to represent relationships in the network model. Network and hierarchical data models are very close to implementation and complicates the task of modeling data.
Relational Data Model: This model uses a collection of tables for representing data and the relationships among the data. Tables are termed as relations.  Each table is associated with fixed set of fields and types. More details about this model will be discussed in subsequent lectures.
A DBMS based on the relational data model is termed as Relational DBMS. A RDBMS not only manages the data but also responsible, but not limited to, for managing the following important functions:
a)      Managing of data and relationships stored in the database. System creates data dictionary as a user created database. Data dictionary is a system oriented dictionary and stores metadata ( data about data).  Information about  tables names, attribute names, data types, physical space, relationships, and so on are part of this meta data.
b)      DBMS system manages the day – day transactions
c)       DBMS system allows the users to specify validation rules.  Enforcing only possible values for sex are only male( M) and female (F) for attribute SEX is an example for validation rule.  Users can set validation rules to keep incorrect values for being accepted. That means we can enforce only correct values to enter into the database.
d)      Access through passwords, encryption and restricted user rights are possible using DBMS.
e)      Provides mechanism to use  backup and recovery procedures for physical security of data is another function which is important in DBMS.
f)       Sharing of data with data locking possibilities is allowed in DBMS
g)      DBMS transforms logical requests to match physical data structures is taken care very well in DBMS.
There are two types of data independence. These are useful for insulating the applications
There are two types of logical models. Relational, network and hierarchical data models belong to record based type and the other kind of model is of type semantic data model.  Entity Relationship model belong to semantic data model.
Database Languages: To specify the database schema, Data definition language is used and data manipulation language is used to write queries and update the data stored in the database. In fact both are part of the most widely used query language called Structured Query Language. Various types of access possible are retrieval information from the database, inserting new information into the database, deleting the existing information from the database and modification of information that present in the database. There are two types of DMLs. One is called procedural, which require a user to specify what data are needed and how to get those data. The other one is called Declarative  DMLs, in which user specify what data are needed without specifying how to get those data.  Relational algebra and relational calculus are theoretical languages where as SQL, QUEL, are of commercial query languages.  In subsequent lectures, we study more about relational algebra, relational calculus and SQL in detail for query writing and how to get the data from the database. 

1 comment: