Presented By
Dr O Rama Devi
Professor,
Dept. of AI&DS, LBRCE
Topics discussed
��
�
Definitions�Data: Raw, unprocessed facts� Ex:25,Suresh,Bangalore�Information: processed Data� Ex:The age of suresh is 25.�Database: Collection of related data� Ex: Online Banking system, Library Management system�Metadata: The Database Definition��
Database Management System
Define: Specifying the data type, structures and constraints for the data to be stored
Construct: Process of storing data on some storage medium.
Manipulate: Querying the database to retrieve specific data, updating database and generating reports.
Share: Allow multiple users and programs to access the database concurrent
���
Properties of Database
University Database- Stores student and course information
Student Name | RollNO | Class | Major |
Smith | 17 | 1 | CS |
Brown | 8 | 2 | CS |
Student
Course Name | Course NO | Dept |
DS | CS13 | CS |
DMS | MATH24 | MATH |
DBMS | CS38 | CS |
Course
Roll_NO | CourseNO | Grade |
17 | MATH24 | B |
17 | CS13 | A |
8 | CS13 | A |
Grade Report
Difference between File System and DBMS
Basis | File System | DBMS |
| The file system is software that manages and organizes the files in a storage medium within a computer. | DBMS is software for Managing the database. |
Data Redundancy | Redundant data can be present in a file system. | In DBMS there is no redundant data. |
Backup and Recovery | It doesn’t provide backup and recovery of data if it is lost. | It provides backup and recovery of data even if it is lost. |
Query processing | There is no efficient query processing in the file system. | Efficient query processing is there in DBMS. |
Basis | File System | DBMS |
Consistency | There is less data consistency in the file system. | There is more data consistency because of the process of normalization. |
Complexity | It is less complex as compared to DBMS. | It has more complexity in handling as compared to the file system. |
Security Constraints | File systems provide less security in comparison to DBMS. | DBMS has more security mechanisms as compared to file systems. |
Cost | It is less expensive than DBMS. | It has a comparatively higher cost than a file system. |
Data Independence | There is no data independence | In DBMS data independence exists. |
.
Characteristics of Database Management Systems
Topics discussed:
Stored in :DB Catalog
Used by :DBMS Software & Database USERS
Relations
Relation_Name | No_of_Columns |
Student | 4 |
Course | 3 |
Grade Report | 3 |
An Example of database catalog
Cloumn name | Data_type | Belogs_to-relations |
Name | Char(30) | Student |
Roll No | Int(4) | Student |
Class | Int(1) | Student |
Major | Major Type | Student |
Course name | Char(10) | Course |
… | | |
Grade | Char(1) | Grade_REport |
Columns
Student Name | RollNO | Class | Major |
Smith | 17 | 1 | CS |
Brown | 8 | 2 | CS |
Student
Course Name | Course NO | Dept |
DS | CS13 | CS |
DMS | MATH24 | MATH |
DBMS | CS38 | CS |
Course
Roll_NO | CourseNO | Grade |
17 | MATH24 | B |
17 | CS13 | A |
8 | CS13 | A |
Grade Report
University Database- Stores student and course information
An Example of Database catalog
ii. Insulation between Programs and Data, and Data Abstraction.
In Traditional file processing----structure of data files is embedded in the application program.
In Database Approach ----Structure of data files is stored in the database catalog----separate from the access programs
(Program data Independence)
Data Item Name | Starting position in Record | Length in Character(Bytes) |
Name | 1 | 30 |
Roll NO | 31 | 4 |
Class | 35 | 4 |
Major | 39 | 4 |
Internal Storage format for a Student Record
A database has many users, each of whom may require a different view of database.
A view---subset of database---contain virtual data derived from database(not explicitly stored)
iii. Support of Multiple Views of the Data.
A Multiuser DBMS allows multiple users to access the database at the same time
DBMS must include concurrency control
OLTP(Online Transaction Processing)---major part of database applications
DBMS must enforce several transaction properties
1) Isolation 2)Atomicity
iv. Sharing of Data and Multiuser Transaction Processing
Advantages of DBMS
.
While DBMS provides inbuilt searching operations. The user only has to write a small query to retrieve data from the database.
Database Users
These are seven types of data base users in DBMS.
Database Administrator (DBA) is a person/team who defines the schema and also controls the 3 levels of database.
The DBA will then create a new account id and password for the user if he/she need to access the data base.
DBA is also responsible for providing security to the data base and he allows only the authorized users to access/modify the data base.
DBA also monitors the recovery and back up and provide technical support. The DBA has a DBA account in the DBMS which called a system or super user account.
DBA repairs damage caused due to hardware and/or software failures.
2. Naive/Parametric End Users:
Parametric End Users are the unsophisticated who don’t have any DBMS knowledge but they frequently use the data base applications in their daily life to get the desired results. For examples, Railway’s ticket booking users are naive users. Clerks in any bank is a naive user because they don’t have any DBMS knowledge but they still use the database and perform their given task.
3. System Analyst :
System Analyst is a user who analyzes the requirements of parametric end users. They check whether all the requirements of end users are satisfied.
4. Sophisticated Users :
Sophisticated users can be engineers, scientists, business analyst, who are familiar with the database. They can develop their own data base applications according to their requirement. They don’t write the program code but they interact the data base by writing SQL queries directly through the query processor.
5. Data Base Designers:
Data Base Designers are the users who design the structure of data base which includes tables, indexes, views, constraints, triggers, stored procedures. He/she controls what data must be stored and how the data items to be related.
6. Application Programmers :
Application Programmers are the back end programmers who writes the code for the application programs. They are the computer professionals. These programs could be written in Programming languages such as Visual Basic, Developer, C, FORTRAN, COBOL etc.
7. Casual Users / Temporary Users :
Casual Users are the users who occasionally use/access the data base but each time when they access the data base they require the new information, for example, Middle or higher level manager.
Data Model
Data Model gives us an idea that how the final system will look like after its complete implementation. It defines the data elements and the relationships between the data elements. Data Models are used to show how data is stored, connected, accessed and updated in the database management system.
Some of the Data Models in DBMS are:
Hierarchical Model
This model organizes the data in the hierarchical tree structure.
The hierarchy starts from the root which has root data and then it expands in the form of a tree adding child node to the parent node.
This model easily represents some of the real-world relationships like food recipes, sitemap of a website etc.
Example: We can represent the relationship between the shoes present on a shopping website in the following way ::
Features of a Hierarchical Model
1. One-to-many relationship: The data here is organised in a tree-like structure where the one-to-many relationship is between the datatypes. Also, there can be only one path from parent to any node. Example: In the above example, if we want to go to the node sneakers we only have one path to reach there i.e through men's shoes node.
2. Parent-Child Relationship: Each child node has a parent node but a parent node can have more than one child node. Multiple parents are not allowed.
3. Deletion Problem: If a parent node is deleted then the child node is automatically deleted.
4. Pointers: Pointers are used to link the parent node with the child node and are used to navigate between the stored data.
Example: In the above example the 'shoes' node points to the two other nodes 'women shoes' node and 'men's shoes' node.
Advantages of Hierarchical Model
Disadvantages of Hierarchical Model
Network Model
.This model is the same as the hierarchical model, the only difference is that a record can have more than one parent.
It replaces the hierarchical tree with a graph.
Example: In the example below we can see that node student has two parents i.e. CSE Department and Library
Features of a Network Model
Advantages of Network Model
Disadvantages of Network Model
Entity-Relationship Model
Entity-Relationship Model or simply ER Model is a high-level data model diagram.
In this model, we represent the real-world problem in the pictorial form to make it easy for the stakeholders to understand.
It is also very easy for the developers to understand the system by just looking at the ER diagram. We use the ER diagram as a visual tool to represent an ER Model.
ER diagram has the following three components:
Example: Teachers, Students, Course, Building, Department, etc are some of the entities of a School Management System.
Example: The entity teacher has the property like teacher id, salary, age, etc.
Example:
In the above diagram, the entities are Teacher and Department. The attributes of Teacher entity are Teacher Name, Teacher_id, Age, Salary, Mobile Number. The attributes of entity Department entity are Dept_id, Dept_name. The two entities are connected using the relationship. Here, each teacher works for a department.
Features of ER Model
Advantages of ER Model
by the database designers for communicating their ideas.
Disadvantages of ER Model
Relational Model
Relational Model is the most widely used model. In this model, the data is maintained in the form of a two-dimensional table. All the information is stored in the form of row and columns. The basic structure of a relational model is tables. So, the tables are also called relations in the relational model.
Example: In this example, we have an Employee table
Features of Relational Model
Advantages of Relational Model
Disadvantages of Relational Model
This ease of design can lead to the development of a poor database which would slow down if the database grows.
But all these disadvantages are minor as compared to the advantages of the relational model. These problems can be avoided with the help of proper implementation and organization
Object-Oriented Data Model
The real-world problems are more closely represented through the object-oriented data model. In this model, both the data and relationship are present in a single structure known as an object. We can store audio, video, images, etc in the database which was not possible in the relational model (although you can store audio and video in relational database, it is adviced not to store in the relational database). ). In this model, two are more objects are connected through links. We use this link to relate one object to other objects. This can be understood by the example given below.
In the above example, we have two objects Employee and Department. All the data and relationships of each object are contained as a single unit. The attributes like Name, Job title of the employee and the methods which will be performed by that object are stored as a single object. The two objects are connected through a common attribute i.e. the Department_id and the communication between these two will be done with the help of this common id.
Database Schema, Instance and State
Example of a Database Schema
Database Schema and Instances
The description of a database is called the database schema, which is specified during database design and is not expected to change frequently.
Three Schema Architecture
A database system is a collection of interrelated files and a set of programs that allow users to access and modify these files. It provides users with an abstract view of the data. That is, the system hides certain details of how the data are stored and maintained.
Developers hide the complexity from users through several abstraction, to simplify users’ interactions with the system.
The data in the DBMS is described at three levels of abstraction
Physical Level
The lowest level of abstraction describes how the data are stored. The physical level has an internal schema which describes the physical storage structure of the database.
Logical Level
The conceptual schema hides the details of physical storage structures and concentrates on describing entities, data types, relationships, user operations, and constraints.
View level
Data Independence
Logical data independence is the capacity to change the conceptual schema without having to change external schemas or application programs.
Physical data independence is the capacity to change the internal schema without having to change the conceptual schema. Hence, the external schemas need not be changed as well.
Three-Schema Architecture
Database System Structure
A database system is partitioned into modules that deal with each of the responsibilities of the overall system. The functional components of a database system can be broadly divided into the storage manager and the query processor components.
Storage manager
Authorization and integrity manager: which tests for the satisfaction of integrity constraints and checks the authority of users to access data.
Transaction manager : which ensures that the database remains in a consistent (correct) state despite system failures, and that concurrent transaction executions proceed without conflicting.
File manager: which manages the allocation of space on disk storage and the data structures used to represent information stored on disk.
Buffer manager: which is responsible for fetching data from disk storage into main memory, and deciding what data to cache in main memory. The buffer manager is a critical part of the database system, since it enables the database to handle data sizes that are much larger than the size of main memory.
The storage manager implements several data structures as part of the physical system implementation:
The Query Processor
The query processor components include
Centralized and Client-Server DBMS Architectures
A Physical Centralized Architecture
Basic 2-tier Client-Server Architectures
Logical two-tier client server architecture
Clients
(LAN: local area network, wireless network, etc.)
DBMS Server
Two Tier Client-Server Architecture
Three Tier Client-Server Architecture
Three-tier client-server architecture