0% found this document useful (1 vote)
70 views58 pages

Subject Name: Database Management Systems Subject Code: 10CS54 Prepared By: Sindhuja K Department: CSE Date

The document provides an overview of a database management systems course. It includes the course code, instructor details, topics covered and learning outcomes. The topics include an introduction to databases, the entity-relationship model, relational model, SQL, database design, and transaction management. The introduction unit discusses characteristics of the database approach such as data independence, data sharing, and multi-user transaction processing. An example database for a university environment is also presented.

Uploaded by

supriya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
70 views58 pages

Subject Name: Database Management Systems Subject Code: 10CS54 Prepared By: Sindhuja K Department: CSE Date

The document provides an overview of a database management systems course. It includes the course code, instructor details, topics covered and learning outcomes. The topics include an introduction to databases, the entity-relationship model, relational model, SQL, database design, and transaction management. The introduction unit discusses characteristics of the database approach such as data independence, data sharing, and multi-user transaction processing. An example database for a university environment is also presented.

Uploaded by

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

Subject Name:

Database Management systems


Subject Code:
10CS54
Prepared By:
Sindhuja K
Department:
CSE
Date

1
10CS54
DATABASE MANAGEMENT
SYSTEMS

Engineered for Tomorrow

2
Elmasri and Navathe: Fundamentals of Database Systems, 5th Edition, Pearson
Education, 2007 (Chapters 1, 2, 3 except 3.8, 5, 6.1 to
6.5, 7.1, 8, 9.1, 9.2 except SQLJ, 9.4, 10)
Raghu Ramakrishnan and Johannes Gehrke: Database Management Systems, 3rd
Edition, McGraw-Hill, 2003. (Chapters 16, 17.1,
17.2, 18)
Reference Books:
Silberschatz, Korth and Sudharshan: Database System
Concepts, 6th Edition, Mc-GrawHill, 2010.
C.J. Date, A. Kannan, S. Swamynatham: An Introduction to Database Systems,
8th Edition, Pearson Education, 2006
Engineered for Tomorrow

3
Engineered for Tomorrow

Objective
• The objective of this course is to prepare students to design and
implement database information systems. It teaches the
students a three-stage methodology for designing relational
database applications, namely, conceptual, logical, and physical
database modeling and design.
• In the first stage students will build a conceptual data model
(ER-Diagram) that is independent of all physical
considerations then to transform this model in the second stage
into the logical model (Relational database). Also students will
translate the logical data model into a physical design (SQL
Queries) for the target DBMS.

4
Engineered for Tomorrow

Course Topics
UNIT 1 - Introduction
UNIT 2 - Entity-Relationship Model
UNIT 3 - Relational Model and Relational Algebra
UNIT 4 - SQL – 1
UNIT 5 - SQL – 2
UNIT 6 - Database Design -1
UNIT 7 - Database Design - 2
UNIT 8 - Transaction Management

5
Unit –I
INTRODUCTION
Engineered for Tomorrow

6
Engineered for Tomorrow

Unit 1- TOPICS
• Introduction, An example
• Characteristics of Database approach
• Users- Actors on the screen, Workers behind the scene
• Advantages of using DBMS approach
• A brief history of database applications, when not to use a
DBMS.
• Data models, schemas and instances
• Three-schema architecture and data independence
• Database languages and interfaces
• The database system environment
• Centralized and client-server architectures
• Classification of Database Management systems. 7
Engineered for Tomorrow

Learning Outcomes
• Students will be able to understand the Database System
Environment in detail with its users, characteristics and
advantages.
• Also the data basic terminologies like data models, schemas and
instances are exposed in this unit .
• Will known about the types of database systems based on their
distribution.

8
Engineered for Tomorrow

Why Database Approach


Databases touch all aspects of our lives

9
Engineered for Tomorrow

1. INTRODUCTION
• Early days database - File systems
• Drawbacks:
• Data redundancy
• Multiple file formats, duplication of information in different files

• No data recovery
• No backup of data
• Inconsistent data
• Multiple file updation
• Limited data sharing and excessive program
maintenance
• Hard to add new constraints or change existing ones

10
Engineered for Tomorrow

1.1 Basic Definitions


• Database:
– A collection of related data.
• Data:
– Real world facts that can be recorded and have an implicit
meaning.
• Database Management System (DBMS):
– A software package/ system to facilitate the creation and
maintenance of a computerized database. (eg. Oracle, SQL
Server , MS Access, DB2, MySQL)
• Database System:
– The DBMS software together with the data itself.
Sometimes, the applications are also included.(eg. Flipkart)
11
Engineered for Tomorrow

A database has the following implicit properties:


• A database represents some aspect of the real world,
sometimes called the miniworld or the universe of
discourse (UoD). Changes to the miniworld re reflected in
the database.
• A database is a logically coherent collection of data with
some inherent meaning. A random assortment of data
cannot correctly be referred to as a database.
• A database is designed, built, and populated with data for a
specific purpose. It has an intended group of users and
some preconceived applications in which these users are
interested.

12
Engineered for Tomorrow

1.2 Database system environment

13
Engineered for Tomorrow

1.3 DBMS Functionality


• Define a particular database in terms of its data types,
structures, and constraints
• Construct or Load the initial database contents on a secondary
storage medium
• Manipulating the database:
– Retrieval: Querying, generating reports
– Modification: Insertions, deletions and updates to its content
– Accessing the database through Web applications
• Processing and Sharing by a set of concurrent users and
application programs – yet, keeping all data valid and
consistent

14
Engineered for Tomorrow

• Other features:
– Protection or Security measures to prevent
unauthorized access
– “Active” processing to take internal actions on
data
– Presentation and Visualization of data
– Maintaining the database and associated programs
over the lifetime of the database application
• Called database, software, and system maintenance

15
Engineered for Tomorrow

2. Example
• Mini-world for the example: Part of a UNIVERSITY environment.
• Some mini-world entities:
– STUDENTs
– COURSEs
– SECTIONs (of COURSEs)
– (academic) DEPARTMENTs
– INSTRUCTORs
• Some relationships:
– SECTIONs are of specific COURSEs
– STUDENTs take SECTIONs
– COURSEs have prerequisite COURSEs
– INSTRUCTORs teach SECTIONs
– COURSEs are offered by DEPARTMENTs
– STUDENTs major in DEPARTMENTs

16
Engineered for Tomorrow

17
Engineered for Tomorrow

18
Engineered for Tomorrow

2.1 Class Diagram Example

19
Engineered for Tomorrow

3. Characteristics of the Database Approach

• Self-describing nature of a database system:


– A DBMS catalog stores the description of a particular database
(e.g. data structures, types, and constraints) called meta-data
(data about data).
– This allows the DBMS software to work with different database
applications.
• Insulation between programs and data:
– Called program-data independence.
– Allows changing data structures and storage organization
without having to change the DBMS access programs.

20
Engineered for Tomorrow

Database catalog

21
Engineered for Tomorrow

• Data Abstraction:
– A data model is used to hide storage details and present the users with a
conceptual view of the database.
– Programs refer to the data model constructs rather than data storage details
• Support of multiple views of the data:
– Each user may see a different view of the database, which describes only the
data of interest to that user.
• Sharing of data and multi-user transaction processing:
– Allowing a set of concurrent users to retrieve from and to update the database.
– Concurrency control within the DBMS guarantees that each transaction is
correctly executed or aborted
– Recovery subsystem ensures each completed transaction has its effect
permanently recorded in the database
– OLTP (Online Transaction Processing) is a major part of database applications.
This allows hundreds of concurrent transactions to execute per second.

22
Engineered for Tomorrow

4. Database Users
• Users may be divided into
– Use and control the database content, and those
who design, develop and maintain database
applications (called “Actors on the Scene”).
– Design and develop the DBMS software and
related tools, and the computer systems operators
(called “Workers Behind the Scene”).

23
Engineered for Tomorrow

4.1 Actors on the scene


– Database administrators:
• Responsible for authorizing access to the database, for coordinating and
monitoring its use, acquiring software and hardware resources, controlling its
use and monitoring efficiency of operations.
– Database Designers:
• Responsible to define the content, the structure, the constraints, and functions
or transactions against the database. They must communicate with the end-
users and understand their needs.
– End-users: They use the data for queries, reports and some of them update the
database content. End-users can be categorized into:
• Casual: access database occasionally when needed
• Naïve or Parametric: they make up a large section of the end-user population.
– They use previously well-defined functions in the form of “canned
transactions” against the database.
– Examples are bank-tellers or reservation clerks who do this activity for
an entire shift of operations.

24
Engineered for Tomorrow

Sophisticated: 4.2 Workers behind the scene


– These include business
analysts, scientists,
engineers, others thoroughly • DBMS system designer and
familiar with the system implementers
capabilities. • Tool Developers
– Many use tools in the form • Operators and maintenance personnel
of software packages that
work closely with the stored
database.
• Stand-alone:
– Mostly maintain personal
databases using ready-to-use
packaged applications.
– An example is a tax program
user that creates its own
internal database.
– Another example is
maintaining an address book

25
Engineered for Tomorrow

5. Advantages of Using the Database Approach

• Controlling redundancy in data storage and in development and


maintenance efforts.
– Sharing of data among multiple users.
• Restricting unauthorized access to data.
• Providing persistent storage for program Objects
– In Object-oriented DBMSs – see Chapters 11-12
• Providing Storage Structures (e.g. indexes) for efficient Query Processing
• Providing backup and recovery services.
• Providing multiple interfaces to different classes of users.
• Representing complex relationships among data.
• Enforcing integrity constraints on the database.
• Drawing Inferences and Actions from the stored data using deductive and
active rules
26
Engineered for Tomorrow

• Others
– Enforce standards
• Flexibility to change data structures:
– Database structure may evolve as new requirements are defined.
• Availability of current information:
– Extremely important for on-line transaction systems such as airline,
hotel, car reservations.
• Economies of scale:
– Wasteful overlap of resources and personnel can be avoided by
consolidating data and applications across departments.

27
Engineered for Tomorrow

6. Historical Development of Database Technology


• Early Database Applications:
– The Hierarchical and Network Models were introduced in mid 1960s and dominated
during the seventies.
– A bulk of the worldwide database processing still occurs using these models.
• Relational Model based Systems:
– Relational model was originally introduced in 1970, was heavily researched and
experimented with in IBM Research and several universities.
– Relational DBMS Products emerged in the 1980s.
• Object-oriented and emerging applications:
– Object-Oriented Database Management Systems (OODBMSs) were introduced in late
1980s and early 1990s to cater to the need of complex data processing in CAD and other
applications.
• Their use has not taken off much.
– Many relational DBMSs have incorporated object database concepts, leading to a new
category called object-relational DBMSs (ORDBMSs)
– Extended relational systems add further capabilities (e.g. for multimedia data, XML, and
other data types)

28
Engineered for Tomorrow

• Data on the Web and E-commerce Applications:


– Web contains data in HTML (Hypertext markup language) with links
among pages.
– This has given rise to a new set of applications and E-commerce is
using new standards like XML (eXtended Markup Language).
– Script programming languages such as PHP and JavaScript allow
generation of dynamic Web pages that are partially generated from a
database
• Also allow database updates through Web pages
• New functionality is being added to DBMSs in the following areas:
– Scientific Applications
– XML (eXtensible Markup Language)
– Image Storage and Management
– Audio and Video data management
– Data Warehousing and Data Mining
– Spatial data management
– Time Series and Historical Data Management 29
Engineered for Tomorrow

7. When not to use a DBMS


• Main inhibitors (costs) of using a DBMS:
– High initial investment and possible need for additional hardware.
– Overhead for providing generality, security, concurrency control,
recovery, and integrity functions.
• When a DBMS may be unnecessary:
– If the database and applications are simple, well defined, and not
expected to change.
– If there are stringent real-time requirements that may not be met
because of DBMS overhead.
– If access to data by multiple users is not required.
• When no DBMS may suffice:
– If the database system is not able to handle the complexity of data
because of modeling limitations
– If the database users need special operations not supported by the
DBMS.
30
Engineered for Tomorrow

8. Data Models
• Data Model:
– A set of concepts to describe the structure of a database, the operations for
manipulating these structures, and certain constraints that the database should
obey.
• Data Model Structure and Constraints:
– Constructs are used to define the database structure
– Constructs typically include elements (and their data types) as well as groups
of elements (e.g entity, record, table), and relationships among such groups
– Constraints specify some restrictions on valid data; these constraints must be
enforced at all times
• Data Model Operations:
– These operations are used for specifying database retrievals and updates by
referring to the constructs of the data model.
– Operations on the data model may include basic model operations (e.g. generic
insert, delete, update) and user-defined operations (e.g. compute_student_gpa,
update_inventory)
31
Engineered for Tomorrow

8.1 Categories of Data Models


• Conceptual (high-level, semantic) data models:
– Provide concepts that are close to the way many users perceive
data.
• (Also called entity-based or object-based data models.)
• Physical (low-level, internal) data models:
– Provide concepts that describe details of how data is stored in the
computer. These are usually specified in an ad-hoc manner
through DBMS design and administration manuals
• Implementation (representational) data models:
– Provide concepts that fall between the above two, used by many
commercial DBMS implementations (e.g. relational data models
used in many commercial systems).

32
Engineered for Tomorrow

8.2 Schemas versus Instances


• Database Schema:
– The description of a database.
– Includes descriptions of the database structure,
data types, and the constraints on the database.
• Schema Diagram:
– An illustrative display of (some aspects of) a
database schema.
• Schema Construct:
– A component of the schema or an object within the
schema, e.g., STUDENT, COURSE.
33
Engineered for Tomorrow

8.3 Database State


• Database State:
– The actual data stored in a database at a particular moment in time. This includes the
collection of all the data in the database.
– Also called database instance (or occurrence or snapshot).
• The term instance is also applied to individual database components, e.g. record
instance, table instance, entity instance
• Database State:
– Refers to the content of a database at a moment in time.
• Initial Database State:
– Refers to the database state when it is initially loaded into the system.
• Valid State:
– A state that satisfies the structure and constraints of the database.
• Distinction
– The database schema changes very infrequently.
– The database state changes every time the database is updated.

• Schema is also called intension.


• State is also called extension.
34
Engineered for Tomorrow

Database Schema

35
Engineered for Tomorrow

9. Three-Schema Architecture
• Proposed to support DBMS characteristics of:
– Program-data independence.
– Support of multiple views of the data.
• Not explicitly used in commercial DBMS
products, but has been useful in explaining
database system organization

36
Engineered for Tomorrow

• Defines DBMS schemas at three levels:


– Internal schema at the internal level to describe physical storage
structures and access paths (e.g indexes).
• Typically uses a physical data model.
– Conceptual schema at the conceptual level to describe the
structure and constraints for the whole database for a community
of users.
• Uses a conceptual or an implementation data model.
– External schemas at the external level to describe the various user
views.
• Usually uses the same data model as the conceptual level.

37
Engineered for Tomorrow

The three-schema architecture

38
Engineered for Tomorrow

• Mappings among schema levels are needed to


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

39
Engineered for Tomorrow

9.1 Data Independence


• Logical Data Independence:
– The capacity to change the conceptual schema
without having to change the external schemas and
their associated application programs.
• Physical Data Independence:
– The capacity to change the internal schema
without having to change the conceptual schema.
– For example, the internal schema may be changed
when certain file structures are reorganized or new
indexes are created to improve database
performance
40
Engineered for Tomorrow

• When a schema at a lower level is changed,


only the mappings between this schema and
higher-level schemas need to be changed in a
DBMS that fully supports data independence.
• The higher-level schemas themselves are
unchanged.
– Hence, the application programs need not be
changed since they refer to the external schemas.

41
Engineered for Tomorrow

10. DBMS Languages


• Data Definition Language (DDL)
• Data Manipulation Language (DML)
– High-Level or Non-procedural Languages: These include the relational
language SQL
• May be used in a standalone way or may be embedded in a programming
language
– Low Level or Procedural Languages:
• These must be embedded in a programming language
 Storage definition language (SDL)
• Specifies the internal schema
 View definition language (VDL)
• Specifies user views/mappings to conceptual schema

42
Engineered for Tomorrow

10.1 DBMS Languages


• Data Definition Language (DDL):
– Used by the DBA and database designers to specify the conceptual schema of a
database.
– In many DBMSs, the DDL is also used to define internal and external schemas
(views).
– In some DBMSs, separate storage definition language (SDL) and view
definition language (VDL) are used to define internal and external schemas.
• SDL is typically realized via DBMS commands provided to the DBA and database
designers
• Data Manipulation Language (DML):
– Used to specify database retrievals and updates
– DML commands (data sublanguage) can be embedded in a general-purpose
programming language (host language), such as COBOL, C, C++, or Java.
• A library of functions can also be provided to access the DBMS from a
programming language
– Alternatively, stand-alone DML commands can be applied directly (called a
query language).

43
Engineered for Tomorrow

10.2 DBMS Interfaces


• Stand-alone query language interfaces
– Example: Entering SQL queries at the DBMS interactive SQL interface
(e.g. SQL*Plus in ORACLE)
• Programmer interfaces for embedding DML in programming languages
• User-friendly interfaces
– Menu-based, forms-based, graphics-based, etc.
• Menu-based interfaces for Web clients or browsing
• Forms-based interfaces
• Graphical user interfaces
• Natural language interfaces
• Speech input and output
• Interfaces for parametric users
• Interfaces for the DBA

44
Engineered for Tomorrow

11. DBMS Component Modules

45
Engineered for Tomorrow

• The DBMS system structure is divided into two component


modules.
• Upper module - different users of the database environment and their
interfaces.
• Lower module - internals of the DBMS responsible for storage of data and
processing of transaction.
• UPPER Module
• DBA staff
• Defines the database and makes changes to its description using the DDL and other privileged
commands.
• The DBMS catalog stores the description of the schemas that are processed by the DLL
compilers.
• The catalog includes names and sizes of the files, data types, storage details of each file,
mapping information among schemas and constraints.
• Casual users (persons with occasional need)
• Utilize menu based or form based query interfaces.
• The query compiler parses the queries, analysis the data elements for its correctness and
converts it into internal form.
• The internal query is passed through the query optimizer for rearrangement of operations and
elimination of redundancies.

46
Engineered for Tomorrow

• Application programmer
– Writes programs in host languages.
– The precompiler separates the DML command and the host program.
– DML commands are submitted to the DML compiler and the rest of the
program to the host compiler.
– The outputs of DML compiler and host compiler are linked by the compiled
transaction to form the executable codes which includes the calls to the runtime
database processor.
• Parametric users
– Supply the parameters (eg. account number and amount for bank withdrawal)
using the compiled transactions.
• The privileged commands, executable query plan and the
compiled transactions with the runtime parameters are
executed by the runtime database processor. It refers the
data dictionary for updations.

47
Engineered for Tomorrow

• LOWER module
– Stored data manager carry out the input and output
operations between the disk and main memory and
provides support for database management including
management of access paths and indexes.
– The file manager deals with the data structure options for
storing in the database and maintains the metadata as well
as indexes for various files.
– The interfacing between the main memory and disk is
handled by the buffer manager.
– The transaction manager is responsible for concurrency
and crash recovery by maintaining a record of all changes
to the database.
48
Engineered for Tomorrow

11.1 Database System Utilities


• To perform certain functions such as:
– Loading data stored in files into a database.
Includes data conversion tools.
– Backing up the database periodically on tape.
– Reorganizing database file structures.
– Report generation utilities.
– Performance monitoring utilities.
– Other functions, such as sorting, user monitoring,
data compression, etc.
49
Engineered for Tomorrow

11.2 Other Tools


• Data dictionary / repository:
– Used to store schema descriptions and other information such as design
decisions, application program descriptions, user information, usage
standards, etc.
– Active data dictionary is accessed by DBMS software and
users/DBA.
– Passive data dictionary is accessed by users/DBA only.
• Application Development Environments and CASE
(computer-aided software engineering) tools:
• Examples:
– PowerBuilder (Sybase)
– JBuilder (Borland)
– JDeveloper 10G (Oracle)
50
Engineered for Tomorrow

12.DBMS Architecture
• 12.1 Centralized DBMS
– In a centralized database system the DBMS functionalities,
application programs, and user interface are carried out on a
single/centralized system. User can connect through a remote
terminal which is connected to central computer.

Terminal 1

Terminal 2

Centralized System
Terminal 3
SOFTWARE

Centralized
Database

Terminal n
HARDWARE/FIRMWARE
51
Engineered for Tomorrow

12.2 Client-Server Architectures


• In client – server architecture the database users are not present at
the site where the database resides, but access it through a
network.
• The client machine is a remote system where the database user
works and server machine is where the database resides.
– Servers can be print server, file server, DBMS server and web server which are
connected via a network. The figure shows logical two-tier client server
architecture.
– The client machine provides interface to access the servers through appropriate
interfaces.
CLIENT CLIENT CLIENT …………..

Network

Printer File DBMS Web ……………..


Server Server Server Server
52
Engineered for Tomorrow

12.3 Two-tier client/server architecture


• The client accesses the different server resources through a client software
module.
• Here the applications that reside at the client machine access the database
through query languages. Transaction services and database query is provided by
DBMS server. Clients use Application Program Interface (API) to access the
server. Some interfaces include ODBC (Open Database Connectivity) and JDBC
for Java programming access

Site 1 CLIENT
Site n
USER Application CLIENT &
SERVER

Communicatio
Site 2 SERVERS n Network
USER

Application
53
Engineered for Tomorrow

12.3 Three-Tier Client/Server Architecture


• This architecture is more suitable for CLIENT
USER
enterprise level applications that run on World
Wide Web (WWW). Application
• This architecture includes an intermediate Client

layer called Application Server or Web


Server. The application server helps in Application Server or Web Server
(Application Programs, Web Pages)
sending partially processed data between the
database server and the client. Clients can
access the database server via a middle tier
SERVER
and architecture enhances security. Mainly
Database
used for web applications. Management
System

54
Engineered for Tomorrow

12.4 Latest Architecture


• Distributed Architecture (Oracle version.i)
• Parallel Architecture (Oracle version.i)
• Grid based Architecture (Oracle version.g)
• Cloud base Architecture (Oracle version.c)
• Latest Oracle s/w in market
– Oracle 12.c supporting cloud environment

55
Engineered for Tomorrow

13. Classification of DBMSs


• Based on the data model used
– Traditional: Relational, Network, Hierarchical.
– Emerging: Object-oriented, Object-relational.
• Other classifications
– Single-user (typically used with personal computers)
vs. multi-user (most DBMSs).
– Centralized (uses a single computer with one database)
vs. distributed (uses multiple computers, multiple databases)
• Homogeneous DDBMS
• Heterogeneous DDBMS
• Federated or Multidatabase Systems
• Distributed Database Systems have now come to be known as client-server based
database systems because:
– They do not support a totally distributed environment, but rather a set of
database servers supporting a set of clients.

56
Engineered for Tomorrow

• Cost Range: from free open-source systems to configurations costing


millions of dollars
• Examples of free relational DBMSs: MySQL, PostgreSQL, others
• Commercial DBMS offer additional specialized modules, e.g. time-series
module, spatial data module, document module, XML module
– These offer additional specialized functionality when purchased
separately
– Sometimes called cartridges or blades
• Different licensing options: site license, maximum number of concurrent
users (seat license), single user, etc.

57
Engineered for Tomorrow

Summary
• Types of Databases and Database Applications
• Basic Definitions
• Typical DBMS Functionality
• Example of a Database (UNIVERSITY)
• Main Characteristics of the Database Approach
• Database Users
• Advantages of Using the Database Approach
• When Not to Use Databases
• Data Models and Their Categories
• History of Data Models
• Schemas, Instances, and States
• Three-Schema Architecture
• Data Independence
• DBMS Languages and Interfaces
• Database System Utilities and Tools
• Centralized and Client-Server Architectures
• Classification of DBMSs

58

You might also like