dbms module 1

48
Overview of DBMS Overview of DBMS Database Defined:: Database Defined:: A database is a A database is a collection of data which can be used: collection of data which can be used: alone, or alone, or combined / related to other data combined / related to other data to provide answers to the user’s to provide answers to the user’s question question It is A collection of related data It is A collection of related data organized in a way that facilitates organized in a way that facilitates data searches. data searches.

Upload: madhavi-chandrakant-sawant

Post on 27-Mar-2015

222 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Dbms Module 1

Overview of DBMSOverview of DBMS

Database Defined::Database Defined::

A database is a collection of data A database is a collection of data which can be used: which can be used:

alone, or alone, or combined / related to other data combined / related to other data to provide answers to the user’s questionto provide answers to the user’s question It is A collection of related data It is A collection of related data

organized in a way that facilitates data organized in a way that facilitates data searches.searches.

Page 2: Dbms Module 1

Example of a Student Example of a Student DatabaseDatabase

Page 3: Dbms Module 1

Databases Databases Before the Use of ComputersBefore the Use of Computers

Data was stored in:Data was stored in:– booksbooks– ledgersledgers– card filescard files– foldersfolders– file cabinetsfile cabinets– or simply in people’s heads!?or simply in people’s heads!?

Page 4: Dbms Module 1

Computers make the process Computers make the process of storing and managing data of storing and managing data

easiereasier

Page 5: Dbms Module 1

The Database ApproachThe Database Approach

Database Management SystemDatabase Management System– software application which allows you to software application which allows you to

create, store, organize, and retrieve create, store, organize, and retrieve data from a single database or many data from a single database or many databases. databases.

– Example: MS AccessExample: MS Access

Page 6: Dbms Module 1

DATABASE MANAGEMENT DATABASE MANAGEMENT SYSTEMSSYSTEMS

A DBMS is a collection of programs A DBMS is a collection of programs whichwhich

provide management of databases provide management of databases

control access to datacontrol access to data

contain a query language to retrieve contain a query language to retrieve

information easily information easily

Page 7: Dbms Module 1

Cont……..Cont…….. Database DesignDatabase Design It is important to design the database in It is important to design the database in

such a way that:such a way that:

A specific item can be reached easily A specific item can be reached easily

(maximum guarantee that the desired record will (maximum guarantee that the desired record will

bebe

reached) reached)

The database can respond to the user’sThe database can respond to the user’s

different questions easily different questions easily

(necessary relationships are provided)(necessary relationships are provided)

Page 8: Dbms Module 1

DATABASE MANAGEMENT DATABASE MANAGEMENT SYSTEMSSYSTEMS

The database occupies minimum storage spaceThe database occupies minimum storage space

(choosing data types and how to express a certain(choosing data types and how to express a certain

concept is important) concept is important)

The database contains no unnecessary dataThe database contains no unnecessary data

(storing the gross salary is enough, the net salary(storing the gross salary is enough, the net salary

can be calculated from the gross salary) can be calculated from the gross salary)

Data can be added and updated easilyData can be added and updated easily

without causing mistakes without causing mistakes

(no data redundancy)(no data redundancy)

Page 9: Dbms Module 1

A Database Contains A Database Contains the Following:the Following:

TablesTables– how entities are represented in a how entities are represented in a

database, where each row is a record database, where each row is a record and each column a field. and each column a field.

FieldsFields– individual pieces of informationindividual pieces of information

RecordRecord– collection of related fields within one collection of related fields within one

entityentity

Page 10: Dbms Module 1

Sample Data TableSample Data Table

Page 11: Dbms Module 1

Key Database Issues Key Database Issues and Activitiesand Activities

Entering and Querying DataEntering and Querying Data Creating Database ReportsCreating Database Reports Data StructureData Structure Data TypeData Type

Page 12: Dbms Module 1

Entering DataEntering Data

Data Entry:Data Entry:– process of getting information into a process of getting information into a

databasedatabase– possible methods of data entry:possible methods of data entry:

Data Entry Professional, Electronic Files, Data Entry Professional, Electronic Files, Historical Records, or Web Based (Forms)Historical Records, or Web Based (Forms)

Page 13: Dbms Module 1

Querying DataQuerying Data

Querying:Querying:– how we get information from a databasehow we get information from a database

Structured Query Language (SQL):Structured Query Language (SQL):– most common language used to most common language used to

interface with databasesinterface with databases– Example:Example:

SELECT DISTINCTROW STUDENT_ID, GRADESELECT DISTINCTROW STUDENT_ID, GRADEFROM GRADESFROM GRADESWHERE GRADE = “A”WHERE GRADE = “A”ORDER BY STUDENT_ID;ORDER BY STUDENT_ID;

Page 14: Dbms Module 1

Querying Data continuedQuerying Data continued

Query By Example (QBE)Query By Example (QBE)– enables you to fill out a grid, or enables you to fill out a grid, or

template, in order to construct a template, in order to construct a description of the data you would like to description of the data you would like to retrieve.retrieve.

Page 15: Dbms Module 1

Cont….Cont….

Page 16: Dbms Module 1

Creating Database ReportsCreating Database Reports Report:Report:

– A compilation of data from the database A compilation of data from the database that is organized and produced in a that is organized and produced in a printed format.printed format.

– Typically produced on paper, but also Typically produced on paper, but also can be displayed on-screen.can be displayed on-screen.

– Example: Quarterly Sales ReportExample: Quarterly Sales Report

Page 17: Dbms Module 1

Data StructureData Structure

Database has two parts:Database has two parts:– DataData– Data Structure: how the data is organized.Data Structure: how the data is organized.

Data Model:Data Model:– representation of entities and their representation of entities and their

relationships to the real worldrelationships to the real world Primary Key:Primary Key:

– a unique identifier in the databasea unique identifier in the database– one or more fieldsone or more fields

Page 18: Dbms Module 1

Data TypeData Type

Data Type:Data Type:– each field in the database needs to be of each field in the database needs to be of

a certain typea certain type– Examples: text, number, datesExamples: text, number, dates

Data Dictionary:Data Dictionary:– a document (often published online) a document (often published online)

prepared by the database designers to prepared by the database designers to assist users in data entry.assist users in data entry.

Page 19: Dbms Module 1

Data Dictionary Example:Data Dictionary Example:

Students TableStudents Table

Primary KeyPrimary Key Field NameField Name Field Field TypeType Field LengthField Length

yesyes Student IDStudent ID NumberNumber 99

nono Last NameLast Name TextText 2020

nono First NameFirst Name TextText 1515

Page 20: Dbms Module 1

Data processing Data processing EnvironmentEnvironment

data base - consists of data elements data base - consists of data elements and the relationships between themand the relationships between them

it is a collection of data organized toit is a collection of data organized to– service many applications at the same service many applications at the same

timetime– by storing and managing data so that by storing and managing data so that

they appear to be in one locationthey appear to be in one location DBMS - database management DBMS - database management

systemsystem

Page 21: Dbms Module 1

Cont……….Cont……….

special special softwaresoftware to create and to create and maintain a database and allow maintain a database and allow individual business applications to individual business applications to extract data they need without extract data they need without having to create separate fileshaving to create separate files

DBMS promotes independence DBMS promotes independence between data, programs, and the between data, programs, and the databasedatabase

Page 22: Dbms Module 1

Limitation of Data processing Limitation of Data processing Environment Environment

1.data redundancy1.data redundancy– presence of duplicate data in multiple filespresence of duplicate data in multiple files– error proneerror prone

2.2. lack of flexibilitylack of flexibility– traditional file system cannot deliver traditional file system cannot deliver ad ad

hoc hoc reportsreports– information needed for ad hoc reports is information needed for ad hoc reports is

somewhere in the system, but too somewhere in the system, but too difficult/expensive to easily retrievedifficult/expensive to easily retrieve

Page 23: Dbms Module 1

Cont……Cont……

3.3. poor securitypoor security– because there is little control or because there is little control or

management of data, access to and management of data, access to and distribution of information is not distribution of information is not controlledcontrolled

4.4. lack of data sharing and lack of data sharing and availabilityavailability– due to lack of control over data resource, due to lack of control over data resource,

not easy to share data - pieces of not easy to share data - pieces of information is in different files in different information is in different files in different parts of organizationparts of organization

Page 24: Dbms Module 1

Components of DBMS Components of DBMS EnvironmentEnvironment

Page 25: Dbms Module 1

Cont…….Cont……. HardwareHardware

– Can range from a PC to a network of Can range from a PC to a network of computers.computers.

SoftwareSoftware– DBMS, operating system, network software (if DBMS, operating system, network software (if

necessary) and also the application programs.necessary) and also the application programs. DataData

– Used by the organization and a description of Used by the organization and a description of this data called the schema.this data called the schema.

ProceduresProcedures– Instructions and rules that should be applied to Instructions and rules that should be applied to

the design and use of the database and DBMS.the design and use of the database and DBMS. PeoplePeople

Page 26: Dbms Module 1

Advantages of DBMSAdvantages of DBMS

Control of data redundancyControl of data redundancy Data consistencyData consistency More information from the same amount More information from the same amount

of dataof data Sharing of dataSharing of data Improved data integrityImproved data integrity Improved securityImproved security Enforcement of standardsEnforcement of standards Economy of scaleEconomy of scale

Page 27: Dbms Module 1

Cont…..Cont…..

Balanced conflicting requirementsBalanced conflicting requirements Improved data accessibility and Improved data accessibility and

responsivenessresponsiveness Increased productivityIncreased productivity Improved maintenance through data Improved maintenance through data

independenceindependence Increased concurrencyIncreased concurrency Improved backup and recovery servicesImproved backup and recovery services

Page 28: Dbms Module 1

Data IndependenceData Independence Ability to modify a schema definition at one Ability to modify a schema definition at one

level without affecting a schema definition in level without affecting a schema definition in the next higher levelthe next higher level

Logical Data IndependenceIndependence – Refers to protection of external schemas to changes in conceptual schema. – Conceptual schema changes (e.g. addition/removal of entities). – Should not require changes to external schema or rewrites of application programs.

Page 29: Dbms Module 1

Data independenceData independence

Physical Data Independence

– Refers to immunity of conceptual schema to changes in the internal schema. – Internal schema changes (e.g. using different file organizations, storage structures/devices). – Should not require change to conceptual or external schemas.

Page 30: Dbms Module 1

Data AbstractionData Abstraction

The major purpose of a database The major purpose of a database system is to provide users with an system is to provide users with an abstract viewabstract view of the system. The of the system. The system hides certain details of how system hides certain details of how data is stored and created and data is stored and created and maintained is called data abstractionmaintained is called data abstraction

Page 31: Dbms Module 1

Three levels of data Three levels of data abstractionabstraction

External – Users' view of the database. – Describes that part of database

that is relevant to a particular user. Conceptual Level – Community view of the database. – Describes what data is stored in

database and relationships among the data.

Page 32: Dbms Module 1

Cont….Cont….

Internal Level (physical level) – Physical representation of the

database on the computer . – Describes how the data is stored in

the database.

Page 33: Dbms Module 1

Cont……Cont……

     

Page 34: Dbms Module 1

Cont….Cont…. Physical level (internal level) describes how a Physical level (internal level) describes how a

record (e.g., customer) is stored.record (e.g., customer) is stored. Logical level: describes data stored in Logical level: describes data stored in

database, and the relationships among the database, and the relationships among the data.data.

typetype customer = customer = recordrecordnamename : string; : string;streetstreet : string; : string;citycity : integer; : integer;

endend;; View level (External level) : application View level (External level) : application

programs hide details of data types. Views can programs hide details of data types. Views can also hide information (e.g., salary) for security also hide information (e.g., salary) for security purposes. purposes.

Page 35: Dbms Module 1

Three-level ArchitectureThree-level Architecture

PhysicalSchema

how the data are physically stored

actual data

1st levelof abstraction

ConceptualSchema

what data are stored,what relationships, constraints exist

2nd levelof abstraction

ExternalSchema 1(Savings A/C)

ExternalSchema 2

(Checking A/C)

ExternalSchema n(IRA A/C/)

...

External Schemas customizations of the conceptualschema to theneeds of variousclasses of users

3rd level of abstraction

Page 36: Dbms Module 1

Data modelsData models

Data Modeling: Data Modeling:

A model that describes in A model that describes in an abstract way how data are an abstract way how data are represented in a business represented in a business organization, an information system, organization, an information system, or a database management system.or a database management system.

Page 37: Dbms Module 1

Defining The Types Of Models

Business Data Model describes the data using business terms and semantics. A Business Entity is the artifact within a Business Information Model.

• Storage Model describes the private representation of the data as it exists in persistent storage e.g. database. This is the Storage Form.

• Collection Model describes the structure of the data as it is received. Each feed may maintain only a fragment of a Business Entity. This is the Collection Form

Page 38: Dbms Module 1

Cont……….Cont………. Retrieval Model describes the data as it is used

by a consuming application. All Retrieval Forms are read-only views of the Business Entity they are based on. This is the Retrieval Form.

• The Enterprise Data Model combines the Business Information Model and the Retrieval Data Models to provide a view of what the data is and where it is used.

• All the models together form the Integrated Data Model that describes the entire corporate universe coherently.

Page 39: Dbms Module 1

Cont…..Cont…..

Page 40: Dbms Module 1

Architecture of a DBMSArchitecture of a DBMS

QueryProcessor

StorageManager

operationSubsystem

SchemaModifications ModificationsQueries

DatabaseSystem

DBMSSoftware

DataData

Definition(Metadata)

Page 41: Dbms Module 1

Overview of conventional Overview of conventional data modelsdata models

The Hierarchical ModelThe Hierarchical Model

The Net work ModelThe Net work Model

The Relational ModelThe Relational Model

Page 42: Dbms Module 1

The Hierarchical ModelThe Hierarchical Model

Records in parent entities can have Records in parent entities can have many child records, but each child many child records, but each child can have only one parent. can have only one parent.

Parent

Child

Page 43: Dbms Module 1

The Network ModelThe Network Model

In this case you can have multiple In this case you can have multiple children and parentschildren and parents

Parents

Children

Page 44: Dbms Module 1

The Relational ModelThe Relational Model

– A good relational database A good relational database design eliminates unnecessary design eliminates unnecessary data duplications and is, data duplications and is, therefore, easier to maintaintherefore, easier to maintain

– Relationship: joining two tables Relationship: joining two tables on a common fieldon a common field

Page 45: Dbms Module 1

Example………..Example………..

Relationship

Page 46: Dbms Module 1

People who with databasePeople who with database

Basically variety of people are Basically variety of people are associated with creation and use of associated with creation and use of database.database.

Ex-:: There are database implementers Ex-:: There are database implementers who build dbms s/w and end users who who build dbms s/w and end users who wish to store and use data in a DBMS.wish to store and use data in a DBMS.

Database implementers work for Database implementers work for vendors like—IBM and Oracle etc..vendors like—IBM and Oracle etc..

End users come from a diverse and End users come from a diverse and increasing number of fields.increasing number of fields.

Page 47: Dbms Module 1

Cont….Cont…. Two other classes people are associated Two other classes people are associated

with a DBMS-::with a DBMS-:: application programmersapplication programmers database administratordatabase administrator application programmers develop application programmers develop

packages that facilitate data access for packages that facilitate data access for end users, who are usually not computer end users, who are usually not computer professionals.professionals.

Application programs should ideally Application programs should ideally access data through external schemaaccess data through external schema

Page 48: Dbms Module 1

Cont….Cont….

Database administratorDatabase administrator here a personal database is here a personal database is

typically maintained by the individual who typically maintained by the individual who owns it and use it.owns it and use it.

DBA is responsible for many critical task DBA is responsible for many critical task like…..like…..

design of conceptual & physical schema.design of conceptual & physical schema. security and authorization.security and authorization. data availability and recovery from data availability and recovery from

failures.failures. database tuning.database tuning.