0% found this document useful (0 votes)
16 views

DBMS_UNIT1

The document provides an overview of Database Management Systems (DBMS), detailing its evolution through three generations, from hierarchical and network models to relational and object-oriented models. It distinguishes between data and information, explains the role of metadata, and outlines the features and components of a DBMS, including its advantages and disadvantages. Additionally, it discusses the history of database systems, the roles of various users, and the responsibilities of a Database Administrator (DBA).

Uploaded by

ashokkmahato2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

DBMS_UNIT1

The document provides an overview of Database Management Systems (DBMS), detailing its evolution through three generations, from hierarchical and network models to relational and object-oriented models. It distinguishes between data and information, explains the role of metadata, and outlines the features and components of a DBMS, including its advantages and disadvantages. Additionally, it discusses the history of database systems, the roles of various users, and the responsibilities of a Database Administrator (DBA).

Uploaded by

ashokkmahato2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Unit-1

Introduction
Basic Concept
- In 1990, at a Conference Silberschatz quoted on a database System.
- The root of DBMS lies in file-based System.

The three generations of DBMS are as:


I first generation
-The hierarchical model is represented by IMS (Information Management System) and network
model by IDS (Integrated Data Store)
- Both of these models were developed in mid-1960s.

II. Second generation


-In 1970, Dr. E.F. Codd proposed a relational model.

II. Third generation.


- It is represented by object-Relational DBMS and object-oriented DBMS

Terms of DBMS
1. Data
- It is known as fact that can be recorded and have implicit meaning
- Actually, data is of raw or isolated facts from which required information is produced.
- Data item refers to an elementary description of things, events, activities and transactions that
are recorded
- e.g., 45679. is meaningless.
other examples can be documents, photographic Images, video segments etc.

2. Information
- It is defined as Collection of related data that when put together produces useful (meaningful)
message to the recipient.
- Actually, data is Converted to more useful or intelligent form
- e.g.; marks, roll number of student form data Whereas marksheet is the information.
- other examples can be pay slip, schedules, reports, worksheet, invoices etc.
Note: Information may further be processed to form knowledge (wisdom).
# Difference between Data and Information
Data Information
Data is raw fact and figure. e.g., 57 is data Data when stored in Some form, like Mark:
57; then it becomes information.
Data does not have significance in business. Information has in business.

Data is atomic level/pieces of information. Information is collection of data.


It does not help in decision making. It helps in decision making.
It is collected from Source directly. It is dependent on data.
for e.g.; 80, 91, 57 are numbers, is data e.g.; 80, 91, 57 are the marks of 3 Subject
then it becomes information.

3. Metadata/Data dictionary
- It is data about data, also known as System Catalog.
- It is data that describes the objects in the data-base.
- It describes database structure, constraints, applications, size of data etc.
- It is integral tool for information resource management.
- It is used by developers to develop software, queries, Controls and procedures to manage and
manipulate the warehouse data.

4. Database
- It is defined as the Collection of logically inter-related data and a description of data designed
to meet the information need of organization.
- It is a self-describing Collection of integrated records, this nature, makes it program data
independence.
- for e-g; a dictionary, a telephone directory, Student record register etc. arranged in some order
(Arranged form).

features of database.
a) shared – Shared among different users/applications.
b) Persistence- exists permanently i.e., live beyond the Scope of process.
c) validity- should be correct with respect to real world entity.
d) Security-Data should be protected from unauthorized user.
e) Consistency values should be consistent with respect to the relationship.
£) Non-redundancy - No two data items in data base should represent same real-world
entity...
g) Independence- Data should be abstract i.e., if should be independent of each other at
different levels.

5. Database Management System (DBMS)


- It is a software system that allows users to define, create, maintain and control access to the
database.
OR
- It is computerized record-keeping System.

Database + DBMS Software =Database system

- DBMS is intermediate layer between Programs- and data. Programs access DBMS which then
access the data.
- A DBMS e a Services for accessing a database but it maintains all required feature of the data.
for e.g.; dbase, FoxPro, MS-Access, Oracle, Sybase etc.
-

Programmer data

Database

DBMS

Modes of data are


a) Queries - It is processed for presentation in views, none of these processes are written in
database.
b) Transactions-It is processed for updating values in database variables. Updates are written in
database.
-Both of these mode uses DBMS for processing.
6. Application program
- It is Computer program that interacts with database issuing an appropriate request (e.g., SQL
Statement) to the DBMS.

7. Data Warehouse and Data warehousing


- It is defined as Subject-oriented, integrated, time-variant, non-updatable Collection of data in
support of management decision making process and business intelligence.
- If focuses on business intelligence, external data and time variant data and not just current data.
- The process of extracting the meaning and making decisions from a data warehouse is known
as Data ware housing.

8. Distributed database
- It is defined as the Collection of data under different DBMS's running on different Computers.
- It is Central System Connected to remate Computers.
- We can access all data from each Site and thus there is not much load on a single central site.
- It can reside on network servers on www, on intranet or extranets.

9. file Based System application


- It is Collection of application programs that perform Services for end-users like Report
Production.
- Here, each program defines and manages its own data.

#Characteristice of file Based System


a) It is group of files that stoves the data of an organization.
b) Each file is independent of one another.
c) each file is flat file.
d) files are designed wing programming languageslike COBOL, C, C++ etc.
e) Each file contains the processed Information for one specific function.

Advantages of file-based System.


I. Helps in overall understanding of database design.
II. Provides historical perspective on how we handle data.
III. It results in smooth transition to newer data-base System.
Disadvantages of file-based System
I. Data redundancy - Duplicity of information in several files which can lead to lays of data
integrity.
II. Poor data Control - Since this System is decentralized in nature so there is no centralized
Control in the fields.
III. Poor data manipulation Capabilities - Because of poor Connection between data in
different files. hence in data manipulation Capability poor.
IV. Data Independence - Since files and records have physical format coded in application
program, the hence when format changes, the Code in each file must be updated.
V. Incompatible file formats - The Structure of files are dependent on application
programming language.
VI. Security problems - Application programs are added to file-oriented System in
adhoc(छनिकप्रयोगकोलानग)manner,every user can access all data.
Difference between file-based system and database management system.
File based system Database management system
i. They are small system like C++ or i. They are large system like oracle or
COBOL program. Sybase
ii. They are relatively cheap. ii. They are relatively expensive.
iii. They have similar structure. iii. They have complex structure.
iv. They need little preliminary design. iv. They need vast preliminary design.
v. They are not secure. v. They are more secured.
vi. They are often single user oriented vi. they are multiple user oriented.
vii. They have isolated data. vii. They have shared data
viii. They have complex backup/recovery viii.They have complex back recovery.
mechanism.
# Approaches to Access Data
- There are two approaches for accessing data
I. file processing Approach/Traditional file processing System. (Already discussed under terms
of database)

II. Database Approach.


The major characteristics of database approachare:
a. Self-describing nature of Database System.
b. Insulation between programs, data and dataabstraction.
c. Support of multiple views of data.
d. Sharing of data and multi-user transaction processing.

Advantages of DBMS
I. Minimization of redundancy/duplicacy.
- There is no duplicacy of same data because of centralized Control of data by database
Administrator.
II. Avoidance of Inconsistency of data
- Due to redundancy, there is problem of inconsistency of data, which can be removed by
minimizing the redundancy.
III. Sharing of data.
- stored data is accessible to multiple usersi.e., data can be shared to multiple application or
users at same time.
IV. Data privacy and Security
a. Authentication - getting username/password.
b. Authorization- gaining the permission to read/write.
V. Data Integrity
- Data Stored in Database is accurate and consistent.
- To ensure data integrity thereenforcednumber of Constraints (rules) which user can
apply. e.g., Mobile numbermust be 10 digit and numeric.
VI. Data Independence - Physical Data Independence and Logical Data Independence
- If change is made at lower-level architecture, upper level is not affected i.e., data is
independent at each level.
VII. Increased ConcurrencyControl
- Simultaneous execution of transaction occurs at same place.
- Multiple users can access the same data item at same time.
VIII. Recovery and Backup
- Users Can backup and recover data from Database usingDBMS.

Marketing Department Sales Department

Data record & entry Data record & entry

DBMS

database

Disadvantages of DBMS
I. Complexity of Recovery and Backup
- Backup and Recovery of data is difficult when data increases in large volume in terms of
TeraByte, Penta Byte, ZettaByteetc.
- More knowledge and skill is required for Backup and recovery.
II. Expensive Hardware and software Cost
- Expensive and quality hardware and software are used for better performance.
- Hardware and software are purchased which are of high cost. e.g., MSSQL Server.
III. Larger size memory for DBMS
- Due to Complexity of DBMS and wide functionality it requires more space in main
memory and Hard disk.
IV. Conversion cost
- The Conversion from old file processing System to modern DBMS is high in terms of
moneyand time.
- Even extra hardware may be required.
V. Technically skilled staff is required.
- Common user Can not operate DBMS.
- Technically skilled staff is required.
- Additional Costmay occur to train andupdate the staff.

# History of Database Systems


- Dr. Herman Hollerith invented Punched Card, was used to record US Census data in
early twentiethcentury.
- Punched Cards were widely used as means of entre entering data into Computers.

• 1950s and early 1960s


- Magnetic tapes were developed for data storage.
- Processing of data Consisted of reading Lata from one or more tapes and writing data to a
new tape.
- Data Could also be input from punched Card decks, and output to printers.

• Late 1960s and 1970s.


- widespread use of hard disk came in late 1960s for data processing since it allowed
directaccess.
- with disk, network and hierarchical database could be created and allowed data structures
such as lists and trees to be stored on disk.
- In 1970 Codd defined relational model hence relational database were born.

• 1980s
- Relational model was not used since it did not match the performance of existing network
and hierarchical database model and were Competitive to each other
- The fully functional System R prototype led to DBM's first relational database product,
SOL/DS.
- Initial Commercial relational Database Systems, such as IBM DB2, Oracle, Ingres and
DEC Rdb.
- Relational database Came in dominance among data models.
- Research was done onparallel and distributed as well as initial work on object-oriented
database.

• Early 1990s
- SQL language was designed primarily for decision support applications, withintensive
update for query and transaction processing.
- Database Vendors introduced parallel database products and also added object-relational
support.
- There was explosive growth of worldwide webwhere database were deployed much
extensively.
- Database system had to support web interfaceto data.

• 2000s
- In mid 2000s XML emerged, associated with query language xQuery as new database
technology.
- for minimizing System administration, there is growth in "autonomic-computing / auto ad
min"technique.
- Significant growth in use of open-Source database systems, particularly PostgreSQL and
MySQL.
- Data-mining techniques are widely used. for e.g., application include web-based product-
recommendation system and automatic placement of relevant advertisements on web
page.
- E.g., Amazon, Facebook, Google, Microsoft, yahoo.

#DBMS Components (Actors)


A DBMS environment Consist of five main Com- ponents (Actors) and are listed as such:

a) Hardware - The hardware of DBMS, Consists of two components":


i) Processor and Main memory
- These two are required to support the execution of DBMS.

ii) Secondary Storage devices


- devices like hard disk, CDs are used to store data.
- Database physically also exist (reside) in hard disk.
- For larger scale organization, number of users are large in number and is larger memory disk se
required to maintain huge quantity of data.
- Also, we need high speed computer, network and peripheral devices.

b) Software
- It is basic interface or layer between the physical database and the users of the system.
- Most Commonly it is known as Database Management System (DBMS).
- DBMS shields the database Wess from Com- plex hardware-level detail.
- Basically, Software Component includes:
DBMS software + Application programs + OS

- Application programs are written in 3GL or 4GL to solve specific problem.


- operating System (OS) includes network software and also if DBMS is being used over the
network.
- In most Cases OS only manages all hardware Components.

c) Data
- From the end user point of view, data is the most important component of DBMS
environment.

- Data acts as bridge between the machine com- ponent and user Component.
- The database contains both the operational data and metadata.
- The database should contain all data needed by the organization.

Note: Database should be designed, built and populated for particular audience and for specific
purpose.

d) Users
- There are users who can access / retrieve data on demand using application and interface
provided by DBMS.
Database users can be classified as follows:
1. Agile users / Naive users
- These users are unaware of presence of database System
- These users work through menu driven application program where response is indicated to
user.
- e.g.; An ATM user, operation performed by is very limited and is precise effect on
database.

2. online users
- Users interact with database via online terminal or indirectly via user interface and
application Program.
- These users are aware of the presence of database system.
- they may have acquired Certain amount of expertise with limited interaction with database.

3. Application programmers
- These programmers write database application programs using some programming language.
- programs have Commands available to manipulate a database.

4. Data base Administrator


- A person or group of incharge for implementing the database System within an organization.
- He/ She has System privileges (rights) allowed byDBMS.
- He/ she can grant and remove access privileges to and from other users.
- DBA is responsible for evaluation Selection and implementing DBMS package.

5. Procedures
- It is instructions and rules that govern the design and use of database.
- users and staff require documented procedure to use and run the system.
- The instruction might consist:
✓ logon to the DBMS. -
✓ Use particular DBMS facility or application program
✓ Start and Stop DBMS.
✓ Make & backup Copic of DBMS.
✓ Handle hardware or software failures.
✓ change structure of table, reorganize the database across multiple disks to improve
performance
# Database Administrator (DBA)
• It is individual person or a group of persons with an overview of one or more database
that he/she can control and design of and the use of databases.
• A DBA is highest Salary paid person in an organization.
• A DBA provides the necessary technical support for implementing policy decision of
database.
• He/she is a Central Controller of the database System who manages all resources like
database, DBMS and related software.
• He/ She is supported by team of System programmers and other technical assistants.

Functions of DBA
i. Defining Conceptual schema.
- create original database scheme and the Structure of database.
ii. Physical database design
- DBA decide who how the data to be in the Stored database.
iii. Securityand integrity Check
- He/she is responsible for providing authorization and authentication.
- He/she must ensure integrity of database also.
iv. Backup and recovery strategies
- DBA must define and implement periodicrecovery strategy to recover the database from
all types of failure.
v. Granting access to users.
- A DBA regulates the usage of specific parts of the database by various users.
- He/she grants access to use the database to users.

#Data Models
Schemas and Instances

Schema
- It is defined as the outline or a plan that describes the records existing at a particular
level.
- Actually, DBMS has three level architecture and there are three different types of
schemas in the database i.e., one scheme per level.
- It is overall description of the database for example,
- A Schema diagram displays only some aspects of a schema like names of record type and
data items and some type of constraints.
- If is specified during database design and it not expected on change frequently.
- It also describes the way in which data elements at one level can be mapped to
corresponding data element in next level.
- They are generally stored in data dictionary.

Instance
- It is collection of information stored in database at particular moment as an instance
of the database.
- Database Change over time when the information is inserted or deleted.
- for example, instance of Stud_ Address
Roll_no Name Address Place Pin
1 Ram prasad Jnk-10 Janakpur 46500
2 Hari Sharma Jnk-12 Kathmandu 57912

- Many database instances Can Correspond to that same database.


- The data in database at particular moment time is called as a database state or snap-shot
or current set of occurrences or instances in the database.

Subschema
- It is defined asan application programmer's or user's view of data item and record types.
- It is subset of schema and inherits same property schema has.
- Different application can have different view of data.
DBMS Architecture / 3-tier Architecture/ ANSI-SPARCArchitecture
- In 1971, Conference on Data System and Language (CODASYL) appointed Data Base Task
Group (DBTG) who gave standard terminology and general architecture for Database
Systems.
- In 1975, American National Standard Institute (ANSI) - Standards Planning and
Requirements Committee (SPARC) recognized the need for three-level approach.
- DBMS architecture has three levels:
a) External or view level.
b) Conceptual or logical level
c) logical or storage /Physical level

Layer 1: External or View level.


- It is user's view of the database with highest level of abstraction.
- It deals with the way in which data is viewed by individual user.
- Different Viewsmay have different representation of the same data. eg dd/mm/yyyyor
YYYY/MM/YY
- Some views may contain derived or calculateddata also.
- External view can be described by means of external Schema for different view of data.
- External schema consists of definition of logical records and relationship.

• [Note: External schema is written using external data definitional language.]


• [Any given database has one internal (physical), and one Conceptual Schema with just
one set of stored relations]

Layer 2: Conceptual or Logical level.


- It is global view of database.
- This level describes what data is stored in this database and the relationship among data.
- It contains logical structure of entire database as seen by the DBA.
- It is complete viewof data requirements of the organization that is independent of any
StorageConsideration.
- There is only one conceptual view per database and is defined by names, types, length of
each dataitem.
- The Conceptual level represents:
• All entities, their attributes and their relationships.
(Entity is that exist as person, place or thing and is distinct from one another and
attribute is property or characteristics.)
[Note:Good Conceptual schema arrival is called Conceptual database design]
• The Constraints on the data.
• Semantic information about the data.
• Security and integrity information.

Layer 3: Internal level or storage level


- It is physical representation of the database and describes how the data is physically stored
on hardware.
- If covers data structure and file organizations used to store data on storage.
- Itinterfaces with operating System (OS) access methods to place on storage device, builds
index, retrieve data and so on.
- This level Concerns with the following:
• Storage space allocation for data and indexes.
• Record descriptions with size for data items for storage.
• Record placement.
• DataCompressionand data encryption techniques.

Note: Internal level covers the physical implementation of database to achieve optimal run-
time performance and Storage utilization.

➢ let us consider the following Customer's database


Cust_id Cust_name Cust_street Cust_city Cust_balance

Below figure shows the specific information available at each level regarding a particular user.
# Mapping
- There are two types of mapping between three different views.
- It is the responsibility of for mapping between three types of schemas for DBMS.

a) External / Conceptual Mapping


- Each external Schema is related to Conceptual Schema by external/ Conceptual mapping.
- The mapping between the external and Conceptual views gives the Correspondence among the
records and the relationship of external and Conceptual view.
- the Contents of database as accessed by theUser orapplication program of that view
. External view is an abstraction of the conceptual view, which in turn is an abstraction of the
internal view.

b) Conceptual / Internal Mapping


- Conceptual schema is related to the internal Schema by Conceptual / Internal mapping.
- The mapping between the conceptual and Internal (Physical) levels specifies the method of
deriving the Conceptual record from physical database. changing the Storage structure or
schema, the Conceptual View or schema at next level remains unchanged.
- The mapping between the two levels is changed.
- There can be some differences between the conceptual views and Internal views and can be:
i. Representation of numeric values
ii. Representation of string data can be Considered by two views to be coded differently.
iii. The value for one a field in one view could be Computed from the values in one or morefields
of other view.

• The ANSI- SPARC's 3-tier architecture provides efficient mapping and more data
independence.

# Data Independence
- The major objective of ANTS ANSI-SPARC'S 3-tier architecture is to provide data
Independence which upper levels are unaffected by changes in lowerlevels and vice-versa.
- There are two types of data independence:
a) Physical data independence
b)Logical data independence
a) Physical data independence.
- It indicates that the physical storage structure or devices could be changed without affecting the
Conceptual schema.
- The Change would be absorbed by mapping between the conceptual and physical/Internal
levels.
- This independence in achieved by the presence of internal level of database and the mapping/
transformation from Conceptual level of database to the internal level.
- If there is need to change the file organization. our physical device used, a change is required in
Conceptual / internal mapping between the Conceptual and internal level.

[Note: Physical data independence criteria requires that conceptual level does not specify storage
Structures or access methods (like indexing, hashing) to retrieve the data from physical storage
medium]

b) Logical data Independence


- It means that conceptual Schema or level Can be changed without affecting the existing
external schema or level.
-Here, the users are shielded from changes in logical structure of the data.
- The Change would be absorbed by mapping between the external and Conceptual levels.
- It insulates application program from operation such as Combining two records into one or
splitting existing record into two more records.
- It is difficult to achieve logical data Independence than physical data Independence.
- This because logical data independence requires flexibility in design of database and the
Programmer has to force the future requirement or modification in the design.

# Difference between Physical data independence and Logical data independence.


Physical data Independence Logical Data Independence
i. It is ability to modify thewithout causing i. It is the ability to modify logical schema
application programs to causing application withoutcausing application programs to be
programsto be rewritten. rewritten.
ii. Modifications at the physical level are ii. Modifications at the logical level are
necessary improve performance necessary wherever the logical structure of
database is altered.
iii. It is difficult to be achieved iii. it is more difficult to be achieved as
application programs are dependent on the
logical structure of database as altered.
iv. It provides immunity of conceptual or iv. It provides immunity of external
external schemas. schemasor application programs.
v. the conceptual schema insulates user from v. the users are shielded from changes in
changes in physical storage of data. logical structure of data.

# Database Language
- A DBMS must provide appropriate language for each category of users to express
database queries and updates.
- These Database languagesare used to createand maintain database on Computer.

DBMS provides the following languages to provide facilities to it's users:

1. Data Definition Language / Data Description Language (DDL)


-It is a language that allows the user to define data and their relationships to other types of
Data.
- It is mainly used to create files, databases, data dictionary and tables within the databases.
- It is used to define schema- Conceptual schema (Global) or even modify an existing
- After the Compilation of DDL statements, the result is a set of tables stored in files
Collectively Called System Catalog.
- The System Catalog integrates metadata i.e., data that describes objects in database and
makes it easier for those objects to be accessed or manipulated.
- For example, CREATE, ACTER, DROP, RENAME are SQL, DDL statements.
2. Data Manipulation Language (DML)
- It is language that provides set of operations to support the basic data manipulation operations
on data held in database.
- It allows user to insert, update, delete and retrieve data from the database.
-It applies to all the three levels but an internal level we must define Complex low-level
procedures that allow efficient data access.
- At higher level, we emphasize an efficient user. Interaction with the system.
- The part of DMC that involves data retrieval is called as query language.
- DML Can be Categorized as Procedural DML and non-procedural DML.
Procedural DML Non-procedural DML
It specifies "how"the output of DML It specifies "what" output is to be obtained.
statement Can be obtained.
It treats records individually. It operates on set of records.
Network and hierarchical DML are normal Relational DBMS uses this language for
procedural. data retrievals (like SQL, QBE etc.)
It is difficult to use and learn. It is normally easier to learn and use.
e.g.; PL/SQL e.g.; SQL, QBE, QUEL etc.

3. Data Sub Languages (DSL)


- It is Combination of both DML and DDL i.e., DSL = DDL + DMC

4. Storage Definition Language (SDL)


- It is language used to specify the internal Schema in the database.
- The Storage structure and access methods used by database is specified by set of
statements which define the implementation database schemas, hidden from user.

5. View Definition Language (VDL)


- It is used to specify both the Conceptual and external schemas
- The two views of data are:
a) Logical view of data - form that programmer perceives in.
b) Physical view of data - form in which the data actually stored in auxiliary storage.

6. Host language
- It is language in which DML Commands are embedded.
- Most DBMS have a facility for embedding SQL queries in High level programming
languagelike VB 6.0, VC# 6.0 etc.

7. Fourth-Generation Language (4GL) – focuses on "what"?


- It is Compact, efficient and non-procedural programming that is used to improve the
productivity of DBMS.
- For e.g.;
a) SQL b) Report Generators (extract data to create report)
c) Spreadsheet d) Code Generators.
e) Automated Generation of HTML

8. Data Control Language (DCL)


- DCL statements Control the access to date and database using the Statement GRANT and
REVOKE.
- A privilege can be granted to user with GRANT.
- DCL Commands in DBMS are:
a) GRANT- to privilege user.
b) REVOKE - to fake away privilege from users.
c) COMMENT - Add Comment to data dictionary.

# Database Interfaces
- A database management system (DBMS) inter- face is a user interface which allows for
the ability to input queries to a database without wing the query language itself.
- Background detail of database is unknown to user.
- Database interface provides mechanism. through which user interact with the database
without using query language (like SOL).

Types of database Interface


i. Menu based Interface for web client or browsing.
- These interfaces present the user with list of options (also called menus) that lead user
through request.
- User Choose from menus or look through the Content of database for specific objects using
a browser.
- e.g., Pull down menus are very popular technique in web-based interface.
- User is free of remembering specific Commands and Syntax of any query language.
i. Graphical User Interface
- It typically displays a schema to the user in diagrammatic form.
- User Select option or specify queries by pressing a key or pointing to Certain part of the
displayed schema diagram.
- In many cases, GUI utilizes both menus and form.

ii. Form-based interface.


- It displays a form to each user (naive user)
- User can insert or access data from database with the help of form.
- These types of forms are usually designed or created and programmed for users that have
no expertise in operating System.
- DBMS have forms specification language to Support form-based interface.

iii. Natural language Interfaces.


- Natural language Interfaces accept requests written in Common language, generally in
English.
- It can range from simple Commands to voice activated text processing.

v. Speech & Input and output.


- In this interface, there is use of speech to input query & speech as an output to a question
or result of request.
- for e.g., inquiry for telephone directory, flight arrival / departure, and bank account
information with Applications with limited Vocabularies.
- It allows Speech (voice) for input & output of query.
- E.g.; Google Search by voice.

vi. Interfaces for DBA


- Most database system contains privileged commands that can be used only by DBA's
staff.
- These include Commands for creating accounts, setting System parameters, granting
account authorization, Changing Schema, reorganizing the Storage structure of a
database.
Architecture of database system

- Generally, the user interacts with the database management system through an interface. The
DBMS does the processing and retrieves the data from the database.
- Database system is divided into two modules,
1. Storage management
2. Query processing.

- Data stored in database may costs more than trillion bytes of data.
- Main memory cannot accommodate for such large amount of data, hence the data is stored in
disk.
- But for processing data, which needs to be transferred from disk to the main memory.
- But this transfer consumes processor time, hence the data needs to be arranged such that the
data transfer rate is not too high.
- This is taken care by storage manager.
- The main task of database system is to provide the user with simplified view of data.
- This is achieved by hiding the physical level implementation details from the user, the user is
provided with only high-level view.
- But, for faster processing the operations need to be done at physical level. The queries at
logical level into optimal sequence of operations at physical level.

1. Storage Management
- Storage management is handled by storage manager that is basically a program module.
- This module acts as an interface between low-level data stored in database and the
application programs.

- Data is stored in disk using file system provided by operating system.


- The storage manager provides interaction with file manager and converts the complex
DML statements into low-level file system commands.
- In addition to this, storage manager is responsible for storing, retrieving and modifying
data within the database. Storage manager consists of the following key components,

i)Transaction manger
ii) File manager
iii) Buffer manager
iv) Integrity manager
v) Authorization manager.
i) Transaction Manager
- It manages the transactions so as to ensure that data remain in consistent state even after
the system failures.
- It also enables the execution of concurrent transactions without any conflicts.

ii) File Manager


- It manages the process of allocating disk and data structures that are used for representing
the information saved on disk.

iii) Buffer Manager


- It handles the transfer of data from disk onto the main memory and decides what data
must be kept in main memory.

iv) Integrity Manager


- It verifies whether the integrity constraints defined on the data are satisfied.

v) Authorization Manager
- It checks the authority of users and allows only authorized users to access the data.
The following are the different data structures used by storage manager.
(a) Data Files
These are the files that contain the database.
(b) Data Dictionary
It maintains metadata regarding the different data structures used in database.
(c) Indices
It provides fast access to the required data items.

2.Query Processor
i) Interpreter of Data Definition Language Statements
- DDL statements written by DBA to define the schema are interpreted and stored in the data
dictionary.

ii) Compiler of Data Manipulation Language Statements


- As any other compiler, DML compiler converts the DML statements in low-level
instructions. It also optimizes the query i.e., perform "query optimization"
iii) Query Evaluation
- DML compiler converts DML statements into low level instructions which are evaluated
by query evaluation machine.

The overall architecture of database system is,


# Overview of Hierarchical, Network and Relational DBMS.

Data Models

Object based Physical based Record based


data Model data Model Data Model

Hierarchical Models Network Model Relational Model

1. object-based Data model


- It describes data at Conceptual level.
- It uses the Concept of entities, attributes and relationships.

2. Physical Data model


- It describes data at internal level.
- It describes how Data Stored In Computer.
- It represents Information like record structure, record ordering and access paths.

3. Record based model


- It is used in describing data at the logical and view levels.
- The three record-based models are as such:

I. Hierarchical model
- It is one of the oldest data models, dating late 1950s.
- Data is viewed as a collection of relations (Segments) that form hierarchical relation.
- The hierarchical relations are connected together in family tree.
- Each segment contains multiple segment instances.
- The segment pointed to the logical association is referred as child segment and others
Segment as parent segment.
- The Segment pointed to the logical association is referred as child segment and other
segment as parent Segment.
- In general, the segment themselves could form a tree with multiple levels and multiple
branches at each level.
- The segment without parent is called the root.
- The segment that has no children are called as leaves of hierarchical model.

Applications of Hierarchical model


- widely used as Semantic model. Since the real-world Phenomenon are hierarchical in
nature.
- widely used as physical model because of hierarchical structure of disk structure like
tracks, cylinders and so on.
- Example:
a) IMS by IBM
b) IBM and System 2000
c) NOMAD by NCSS.

Advantages of Hierarchical Model


• Simplicity- The relation Ship between layers is logically simple i.e., design is
simple.
• Data sharing - All data are held in Common database; data sharing is practical.
• Data Security - first database model with security.
• Data integrity - As the segments are linked as parent and child, child segments are
always automatically referred by it's parent, hence this model promotes data
integrity.
• Efficiency - This model is efficient when a database contains a large volume of data
in one to many (1:N) relationship and when the users require large number of
transactions.

Disadvantages of Hierarchical Data model


• Implementation Complexity- Semple to design but quite Complex to implement.
Database designer Should have good knowledge of physical data storage
characteristics.
• Inflexibility- lacks flexibility since changes in new relations or segment needs Very
Complex System management.
• Database Management Problems - As the structure of hierarchical the database
changes, there is necessity of change in application program that access database.
• Operational anomalies- This model-suffers from Insert, update and deletion
anomalies, Complex retrieval operation.
• NO standards - Implementation of this model does not Confirm specific standard.
• Implementation limitation - only 1: N relation between segments care supported.

Example
Let us Consider two segments be:
faculty: Name, Department, Course taught

Student Name, Course enrolled, Grade

Then, an instance of hierarchical relation can be Shown as follows:

Ram, CSIT, DBMS

Shyam, DBMS, A Hari, DBMS, B+

II. Network Model


-In late 1960s, the Database Task Group (DBTG) formalized this Network Model as generalized
from hierarchical model.
- In this model, a segment can have multiple parent segment and segments are and segments are
grouped in levels but association can exist between segments belonging to any level and can
have both the directions association.
- The logical associations between the segments are implemented by pointers that reflect many-
to-many association i.e., it allows a record to have more than one parent.
- In network database terminology, a relationship is a set. Each set is made up of at least two
types of records:
a) An owner record (equivalent to parent) A
b) A member record (equivalent to child)

B C

D E F
fig: Network data model.
- In figure above member -B has only one owner A whereas member-E has two owners 'B'
and 'C'.
- Each link between two record types represents 1: M relationships.
- There is lateral as well as top-down connections, hence allows 1:1, 1: M and M:M
relations among entities.
- This model supports multiple paths to Same record, hence avoids data redundancy.
Examples:
a) TOTAL by Cincom Systems Inc.
5) IDMS Cullinane Corp.
c) EDMS by Kerox Corp.

Advantages of Network Model


• Simplicity- This model is simple and easy b design.
• Capable of handling more relationship types- It handles 1:N, M:N and 1:1 relationships
• Easier data access- An application can access an owner record and all members’ record.
• Data integrity- This model does not allow a member to exist without an Owner thus
owner record and member record must be defined, which ensures data integrity.
• Data independence - This model is better as the program is isolated from complex
physical storage details.
• Database Standards. It is based on standard as formulated by DBTG.
[Note: It also includes DDL and DML]

Disadvantages of Network Model


• System Complexity - As the records are maintained using pointers, database structure
becomes very Complex.
• operational anomalies- As pointers used for navigation, implementation becomes quite
Complex. -
• Non user friendly - It is for highly skill-oriented system.
• Absence of structural independence - As the model is navigational system, structural
changes must then application program be changed to access data.
• There is very little scope of automated query optimization.

Example: Draw a Network Model for a Sales organization. Solution:


For Sales organization - CUSTOMER, SALES REPRESENTATIVE, INVOICE,
INVOICE- LINE, PRODUCT and PAYMENT represent record types.
SALES REPRESENTATIVE PRODUCT
1:M 1:M1:M

PRODUCT INVOICE PAYMENT


Representative
1:M1:M

INVOICE-LINE

III. Relational Model


- It is defined as a database that allows us to group it's data items into one or more
independent tables, related to er one another using Common field.
- It is viewed as collection of non-hierarchical time-varying relations.
- it provides a basis for higher-level data language that yields maximum data independence
between the machine representation and organization of data.
- In this model, relational algebra has been used to decompose a Complex logical Structure
in to Collection of simple relations that complex relations of real world can be expressed,
also accessing and updating data can be made simple and efficient.
- Every relation has unique Relational model Store data in the form of tables.
- This model was proposed by Dr. E.F. Codd in 1971, at IBM.
- The relational model consists of three major Components:
i. The set of relations and set of domains defines the way data can be represented.
ii. Integrity rules to protect data.
iii operations that can be performed on data (data manipulation).

- In relational model, data are viewed as an extension or intension of a table.


- The Column of table Contains values of attributes and rows referred to as elements i.e.,
values associated with Individuals in real world i.e., rows Correspond to record.
- The Column is aligned distinct name, takes values from Collection of values known as
domain.
- The same Value may appear in multiples times in a column of a relation but appears only
The Once in domain.
- The degree of a relation is the number of attributes it. Contain.
- The rows of a relation are referred as tuples and all the rows of a relation are distinct.
Characteristics of Relational Database
i. The whole data is conceptually represented as orderly arrangement of data into rows
and Columns, called relation or table.
ii. All values are scaler: At any given row/ Column position in the relation there is oneand
only one value.
iii. All operations are performed on entire relation. and results on entire relation, a
concept is known as closure.

#Basic terminologies used in Relational Model


1. Tuples
- Each row of data is a tuple.
2. Cardinality
- It is defined as number of tuples in relation.
3. Degree of relation
- Each Column in the tuple is called an attribute.
- The number of attributes in a relation is defined as it's degree.
4. Domains
- It is defined as a set of all possible values that an attribute may validly Contain.
- Data type is physical Concept while domain is logical one.
- for e-g., "Number" (datatype) and Age (domain) are both of number type only but one is
data. type and other is domain.
5. Body of relation
- A relation Consists an unordered set of zero or more tuples.
- Record number do not quality relation.
- Relation is a set where each record must be uniquely identifiable i.e.
, the table must contain no duplicate records.
- for example:
Emp_id Emp_name Salary Age
101 Hari 37000 35
102 Shankar 32000 32
103 Omkar 25000 28
104 Amrit 18000 25
105 Manish 24500 33

Fig: A relation.
Here,
degree=4, tuples=5, cardinality=5

6. keys of a relation
- Normally, all data related to student is not Stored in a single table.
- Data that is permanent like Name, date of birth, address, parent's address is stored in one
table, referred to as MASTER or PARENT table.
- MASTER table will contain only one record Student For every Student table

Student table
Roll_no Name Address Place Pin
1 Ram Jnk-1 Janakpur 11002
2 Shyam Pkr-5 Pokhara 15600
3 Hari Dharan-9 Dharan 12905
4 Manish Jnk-10 Janakpur 11001

Student table
Roll_no Subject Date Marks
1 Ram Jnk-1 Janakpur
2 Shyam Pkr-5 Pokhara
3 Hari Dharan-9 Dharan
4 Manish Jnk-10 Janakpur

- MASTERorPARENT table which contains linking Column must be "PRIMARY KEY"


- The linking Column in TRANSACTION table or CHILD table that references
"PRIMARY KEY" is called as a "FOREIGN KEY

Advantages of Relational Model


1. Semple
- Designers can simply concentrate on logical view of database.

2. No anomalies
- Unlike hierarchical and Network model, this model does not suffer from Insert, update,
delete and retrieval operation.

3. Structural independence
- This model does not depend on navigational data access System.
- So, Changes in database structure does not affect the data access.

4. Easier design, implementation, maintenance and usage


- This model makes database design, maintenance, administration and usage much easier than
other models.

5. Better query Capability


- It uses fourth generation language (SQL) that provides powerful, flexible and easy-to-use query
facility.

Disadvantages of Relational Model


1. Hard ware overheads
- This model needs more powerful Computing hardware and storage. devices to perform
RDBMS-assigned tasks.

2. Ease of design
- Ease of design and use Can lead to development and implementation of poorly designed
DBMS.
- The poorly designed database will slow the System and results in performance degradation and
data Corruption.

3. Phenomenon of information is land


- Too many people or departments can create their own database and applications, known
as information island.
- Which then prevents information integration for the smooth and efficient functioning of
organization.
- It might even create problems like data inconsistency, data duplication, data redundancy
etc.

4. SQL does not provide index to provide for efficient browsing alphabetically.

# Data Modelling Using ER-Model


- An ER model was introduced by P.P. Chen in 1976.
- An ER model is defined as a Conceptual data model that views the real world as entities
and relationships.
- An ER-model is useful to a database designer in the following ways:

1. An ER-model maps well to relational model i.e., the Constructs used in the ER model Can
be easily transformed into relational tables.
2. An ER- model Can be used by database designer to Communicate the design to the enduser.
3. An ER-model Can be used as a design plan. by database developer to implement a data
model in specific DBMS Software.

Basic terminologies Related to ER-Model

1. Entities
- It is person, place or thing which exist and is distinguishable from one another.
- for example, Employees, Table, Chalk Board, penetc.
- entity is analogous to a table in relationalmodel.

- Entities are of two types:


a) Independent entity b) Dependent entity

a) Independent entity
- It is entity that does not relies on another for identification. e.g.; In organization Scenario:
e.g., in organization scenario: dept is independent &
b)Dependent entity manager is dependent
- It is entity that relies on another for identification.

Note: An entity occurrence (or instance) is an individual occurrence of an entity, is analogous to


a row in relational table.

2. Entity Type (or set)


- It is defined as a set of entities of Same typethat share the same properties of attributes
- for example, an entity-Set PROJECT with two entities P1 and P2 Can be shown as:
- Here, P1 and P2 are two entities (or relations) with Some attributes (or fields), Say
(PROJ_ID, START_ DATE, END-DATE).
- Then data within table will form a value whereas combined values of P1 and P2 will form
a value-set.
- e.g., All Students of a school are entity of Student entity.

3. Relationships
- It is an association between two or more entities They are classified in terms of degree,
connectivity, Cardinality and existence.
- for example,ISA relationship, HASA relationship etc.

4. Degree of a Relationship
- It is defined as the number of entities associated.
- There are three types of degrees of relationships:

a) Unary or Recursive relationship


b) Binary relationship
c) Ternary relationship

- The n-ary relationship is the general form for degree, n.


- Here, if n=1, the relationship degree is 1, also called Unary relationship.
-If n=2, it is called binary relationship and if n=3, it is called ternary relationship.

a) Unary or Recursive relationship


- It is defined as a relationship between the instances of a single entity type.
- It means that an entity relates only to other instances of its own type.
- For e.g., for example, an Entity PERSONrelates to another entity PERSON by
relationship “manages”i.e., by management.
P managed
E
R manages
S manger
O
N
b) Binary relationship
- Its association between two entities, so it's degree=2.
- This by be relationship occurs when an entity is related to itself.
- For example:

Employee Works on Project


N 1
fig: A binary relationship.
c) Ternary relationship.
- It is association among three entities.
- It is used when used when binary relationship is not Sufficient.
for example:
M 1
Skill Person
uses

Project

fig: A ternary relationship.


- These relation entities are connected with a diamond relationship) named uses.
- We Can designate the Connectivity of each entity as either one' or 'many'.

5. Cardinality or Connectivity.
- It describes the mapping of associated entity instances in the relationship.
- The values of Connectivity are "one" or "many".
- while the actual Count of elements associated with the Connectivity is called Cardinality of
the relationship Connectivity.
- There are three basic types of connectivity. for relations and are follows:

a) One to one (1:1)


- It is when at most one instance of entity (say A) is associated with one instance of another
entity (Say B).
- for example, one teacher teaches one student.

b) one to many (1:M)


- It is when one instance of entity A there is zeroor many instances of entity B.
- For example, one teacher teaches many students.

c) Manytomany(M: N)
- It is when many for one instance of entity A, there are zero, one or
or many instances of entity B.
- For example, many teachersteachmanyStudents.

Note:M: N relationship Cannot be directly translated to relational tables but instead must be
transformed in to two or more one-to-many relationships usingassociative entities.

6. Attributes
- It defines the properties of data object of entity for example attributes of flower are it's
color, it's name, it's texture.
- Similarly, attributes of a ball or it's shape, Color, size etc.
- Here flower, ball are the data objects. The classification of attributesare as such:

Attribute

Simple or atomic Composite Sigle-valued Multi-valued Derived

Fig: types of attributes.


I. Simple (atomic) attribute
- It is defined as an attribute that is composed of a single component with independent existence.
- It cannot be further subdivided.
- For example; Age, Salary, person_ID etc.

II. Composite attribute


- It is defined as an attribute that Compose multiple components with an independent
existence.
- Some attributes can be further divided into smaller components.
- for example; Name is a Composite attribute which can be divided into first_name,
middle_hame and last_name.

Note:Modeling an attribute into Simple or Composite attribute depends on user view of the data.

III. Single-Valued Attribute


- It is attribute that holds a single value for a single entity.
- Majority of attribute are single-valued for a particular entity.
- for example,Roll_No is a single-valued attribute.

IV. Multi-Valued attribute.


- It is attribute that holds multiple values for a single entity.
- For example, 'Person' entity, if one of the attributes is ‘Language', then 'Language' Can
have multiple values like English, Nepali, Maithili and so on.

V. Derived attribute
- It is attribute that represents a value that is derivable from the value of related attribute or
set of attributes, not essentially in same attribute.
- for example, the age attribute Can be derived from Date-of- birth and so are they related.

# Direction
- The direction of a relationship shows the originating entity of a relationships.
- The entity from which a relationship originates is parent entity and where terminates is
child entity.
- Directed line and undirected line is used between the relationship Set and entity set.
• Directed line- Used to indicate one occurrence.
• undirected line-used to indicatemany occurrences.

Examples:

Department Manager

Fig: 1:1 relationship.


Department

Manager

Fig: 1:M relationship.

Manager

Department

Fig: M:M relationship.


Participation Constraints
-It specifies whether the existence of an entity depends on it being related to another entity
via relationship type.
- The Constraints Specify the minimum and maximum number of relationship instances
that each entity Can/ must participate in.
- If all the entities of entity set are participating in the relationship, then is knownas total
participation (i.e., no entity is left out).
- Total participation is denoted by double lines. e.g.; Student takes Courses i.e., there can't
be a student with taking for any Course.

Total Partial
Student taking
taking Course

- If one or more entity of entity of are left out without participating in relationship then is
known as partial participation.
- E.g.; course taken by students i.e., there can beCourse which is not takenby any student.

custid Custname loanno amount


d d d
Customer Loan
borrows

Custcity
#Notations used in ER-Diagram
# Strong and Weak Entity sets
- The entity set which does not have sufficient attributes to form a primary key is known as
weak entity Set.
- On the other hand, the entity set that has a primary key is known as strong entity set.
- Each weak entity set must be a part of 1:M relationship set with relationships double
diamond.
- A member of a strong entity set is called dominant entityand a member of weak entity
setis called a subordinate entity.
- The discriminator (or partial key) of a weak entity set of attributes that distinguishes all
entities of a weak entity set that depends on one particular strong entity.
- primary key of a weak entity set is formedprimary key of strong entity set on which the
weak entity Set is existence dependent.
- weak entity set is shown double rectangles.
- The discriminator of a weak entity set is shown with dashed line.

loanno payno
Amount paydate
ed

Loan Loan
Loan payment

strong weak

# Extended E-R feature

Generalization
- It is the process of identifying some Common Characteristics of a collection of entity sets
and creating anew entity set that contains common features.
- It is a form of abstraction that specifics two or more entities that share Common
attribute can be generalized into higher level entity called super type generic type.
- lower-level entities become the subtype or dependent entities to super type entity.
- Generalization is bottom-up process.
- For e.g., sub-entities car, bus, bike can be generalized into one general super class (base
class) named Vehicle.
Vehicle

car bus bike

- It is similar to inheritance in C++.

Specialization
- It is a process of identifying subsets of an entity (super class/super type) that share some
distinguishing characteristics.
- The process of defining sub class is based on the basis of some distinguishing
characteristics of entities in Super class.
- Here, firstly we define a super-class, then sub-classes and then their attributes and
relationships.
- It is top-down process.
account

ISA

Saving account Fixed account Current account


Example 1:
The peoples bank offers five different types of accounts: Loan, checking, premium Saving, Daily
interest saving and money market. It operates a number of accounts. An account can be joint i.e.,
more than one client can be able to operate a given account. Identity entities and draw E-R
Diagram.

Example 2:
An insurance agent sells insurance policies to clients. Policies can be of different types such as
vehicle insurance, life insurance, accident insurance etc. The agent collects monthly premiums
on the policies the form of cheques of local bank. Appropriate attribute must be assumed for
various entities such as agents, vehicles, policy.
Draw an E-R model for above System. Your E-R model should take advantage of extended E-R
notation where relevant.

Aggregation
- It is a process of Compiling information on an object, thereby abstracting a higher-level
object.
- E-R model cannot express relationship among relationships, Aggregation is a solution to
this problem.
- Aggregation shows a "has a' or ` is part of' relationships between entity types where one
recipient, represents the "whole” and other as “part”.
- This special wind of relationship is called an aggregation [BOOCH, 1998].
- Let us Consider a ternary relationship - work on, between Employee, Branch and
Manager.

- The best way to model this situation is to use aggregation. So, the relationship setworkon
is a higher level
- We can then create a binary relationship, manages between work-on and manager to
represent who manages that task.

You might also like