Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

MA 227 DATABASE SYSTEMS

Dr. SONALI CHAKRABORTY


DEPARTMENT OF MATHEMATICAL AND COMPUTATIONAL SCIENCES
NATIONAL INSTITUTE OF TECHNOLOGY KARNATAKA
SURATHKAL, MANGALORE – 575025, INDIA

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 1


COURSE CONTENTS

▪ Files versus database systems


▪ Three-level architecture of databases
▪ Data Models
▪ Relational algebra
▪ Query languages
▪ Normalization
▪ Physical database organization
▪ Indexing and hashing
▪ Transaction processing
▪ Concurrency control techniques
▪ Database recovery techniques
▪ Database security and authorization

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 2


EVALUATION PLAN & REFERENCES
❑ Exam
▪ Mid-semester exam: 25%
▪ End-semester exam: 50%
❑Assignments/ Quiz: 25%

Reference Books
• Ramez Elmasri, Shamkant B Navathe, Fundamentals of database system,
Addison Wesley, McGraw-Hill, 2000.
• Silberschatz, Korth and Sudarshan, Database System Concepts, 6th
Edition, McGraw Hill, 2011.
• Ramakrishnan, R., Gehrke, Database Management Systems, 3rd Edition,
McGraw Hill

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 3


INTRODUCTION

✓ Data: Raw Facts (Facts that are not yet processed to


reveal the meaning)
✓ Information: Result of processing raw data to reveal its
meaning
✓ Data processing:
✓ Simple processing revealing patterns
✓ Complex processing for making forecasts or inferences

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 4


INTRODUCTION CONTD…
❖Example of survey for restaurants:
Raw Data
Responses Taste Hygiene Ambience Staff Value for
Offline or online Behaviour money
questionnaires 1 4 4 3 4 3
2 3 5 2 3 3
3 5 5 3 3 4

Information
Responses Poor (1) Average (2) Good (3) Very Good (4) Excellent (5)
Taste 0% 10% 20% 50% 20%
Hygiene 0% 0% 30% 30% 40%
Ambience 0% 10% 50% 30% 10%
Staff Behaviour 0% 0% 60% 30% 10%

Value for 0% 0% 60% 20% 20%


money

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 5


INTRODUCTION CONTD…
✓ Database : A collection of related data
✓ Data: Known facts that can be recorded and that have implicit
meaning

Example:
• Address Book: Names, telephone numbers, and addresses
• Mobile phones store this data using simple database software
• Can be stored on a hard drive, using a personal computer and
software such as Microsoft Access or Excel
This collection of related data with an implicit meaning is a database

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 6


INTRODUCTION CONTD…
✓ Database represents some aspect of the real world:
• It some source from which data is derived (survey forms)
• Some degree of interaction with events in the real world
• An audience that is actively interested in its contents; i.e. the end
users of a database may perform business transactions (Restaurant)

✓ 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

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 7


INTRODUCTION CONTD…
✓ Database can be of any size and complexity
For example,
• List of names and addresses containing a few hundred records with a
simple structure
• Computerized catalog of a large library may contain half a million entries
organized under different categories—by primary author’s last name, by
subject, by book title—with each category organized alphabetically
• Database of even greater size and complexity would be maintained by
retail websites and social media company
• Facebook has more than a billion users and the database maintains
information on:
• which users are related to one another as friends
• the postings of each user
• which users are allowed to see each posting
• vast amount of other types of information needed for the correct operation of their
Web site
Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 8
INTRODUCTION CONTD…
✓ For such Web sites, a large number of databases are needed to keep track
of the constantly changing information required by the social media Web
site
✓ Amazon.com contains data for over:
• 60 million active users
• Millions of books
• CDs, videos, DVDs, games
• Electronics, apparel
• Purchase records of millions of visitors everyday
• Continually updating as new books and other items are added to the
inventory
• Updating stock quantities with every purchase transaction

✓ The database occupies over 42 terabytes (a terabyte is 1012 bytes worth of


storage) and is stored on hundreds of computers (called servers).

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 9


INTRODUCTION CONTD…
✓ Database Management System:
• A computerized system enabling users to create and maintain a
database
• General-purpose software system that facilitates the processes
of defining, constructing, manipulating, and sharing databases
among various users and applications
• Defining a database involves specifying the data types,
structures, and constraints of the data to be stored in the
database
• The database definition or descriptive information is also stored
by the DBMS in the form of a database catalog or dictionary; it
is called meta-data (data about data)

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 10


INTRODUCTION CONTD…

✓ Database construction is the process of storing the data on


some storage medium that is controlled by the DBMS
✓ Database manipulation includes functions such as querying
the database to retrieve specific data, updating the database
to reflect the changes, and generating reports from the data
✓ Database sharing allows multiple users and programs to
access the database simultaneously
✓ Database can be accessed by sending queries or requests for
data using an application program accesses
✓ Query causes some data to be retrieved; a transaction may
cause some data to be read and some data to be written into
the database

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 11


INTRODUCTION CONTD…

✓ Important functions provided by the DBMS:


✓ Protecting the database:
• System protection against hardware or software
malfunction (or crashes) and security protection against
unauthorized or malicious access

✓ Maintaining the database over a long period of time:


• Allowing the system to evolve as requirements change
over time

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 12


EXAMPLE
❖ A University database maintaining information concerning students,
courses, and grades in a university environment.
❖ Defining a database : Specify the structure of the records of each
file by specifying the different types of data elements to be stored
in each record:
✓ Student
(Student name, Student ID, Class, Course Name)
✓ Course
(Course name, Course ID, Credit hours, Department Name)
✓ Department
(Department ID, Department Name)
✓ Grades
(Student Name, Course Name, Grade)
✓ Faculty
(Faculty name, Faculty ID, Course Name Department Name)
Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 13
EXAMPLE CONTD…

❖ Constructing the database by storing data to represent each


STUDENT, COURSE, DEPARTMENT, GRADES and
FACULTY as a record in the appropriate file.
❖ The records in the various files may be related. For example, the
record for Student Name in the STUDENT file is related to
records in the GRADES file
❖ Similarly, Course Name is in two files, GRADES and FACULTY
❖ Most medium-size and large databases include many types of
records and have many relationships among the records

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 14


EXAMPLE CONTD…
Student
Stud_Name Stud_ID Class Course_Name
Smith 17 1 C Programming

Pooja 8 2 Fundamentals of
Economics

Course
Course_Name Course_ID Credit_hours Dept_Name

Intro to Computer CS01 4 CS


Science

C Programming CS02 4 CS

Fundamentals of BB01 4 Management


Economics

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 15


EXAMPLE CONTD…
Department
Dept_ID Dept_Name

D1 CS
D2 Management

Grades
Stud_Name Course_Name Grade
Smith C Programming A
Pooja Fundamentals of Economics A+

Faculty
Faculty_Name Faculty_ID Course_Name Dept_Name

Radha F01 Intro to Computer Science CS

Vikram F02 Fundamentals of Management


Economics

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 16


EXAMPLE CONTD…
❖ Database manipulation involves querying and updating
Examples of Queries:
• Retrieve the transcript—a list of all courses and grades—of ‘Smith’
• List the names of students who took the ‘Database’ course and their
grades
• List the faculties of the ‘CS’ department

Examples of Updates:
• Add the course of ‘Intro to Computer Science’ for ‘Smith’
• Create a new course ‘E-commerce’ for the ‘Management’ department

These informal queries and updates must be specified in the query


language of the DBMS before they can be processed

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 17


EXAMPLES FOR PRACTICE

❖ Banking System
❖ Inventory Management System
❖ Hospital Management System
❖ Movie Ticket Booking System
❖ Online Shopping System
❖ Library Management System
❖ Electronic Stores System

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 18


STAGES OF DATABASE DESIGN
• Design of a new application for an existing database or
design of a brand new database starts with requirements
specification and analysis
• Conceptual design: Detailed documentation of the
requirements transformed into a that can be represented and
manipulated using some computerized tools so that it can be
easily maintained, modified, and transformed into a database
implementation
• Logical design: The design is then translated to a that can be
expressed in a data model implemented in a commercial
DBMS

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 19


STAGES OF DATABASE DESIGN CONTD…

• Physical design: Final stage during which further specifications are


provided for storing and accessing the database.
• The database design is implemented, populated with actual data, and
continuously maintained

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 20


DATABASE SYSTEM ENVIRONMENT

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 21


FILE PROCESSING
❖ Traditional file processing:
✓ Each user defines and implements the files needed for a specific
software application as part of programming the application

For example,
• One user: grade reporting office, may keep files on students and their
grades
• Programs to print a student’s transcript and to enter new grades are
implemented as part of the application
• Second user: the accounting office, may keep track of students’ fees and
their payments

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 22


FILE PROCESSING v/s DATABASE SYSTEM CONTD…

• Although both users are interested in data about students, each user
maintains separate files—and programs to manipulate these files—
because each requires some data not available from the other user’s
files
• This redundancy in defining and storing data results in wasted
storage space and in redundant efforts to maintain common up-to-
date data
• In the database approach, a single repository maintains data that is
defined once and then accessed by various users repeatedly through
queries, transactions, and application programs.

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 23


FILE PROCESSING v/s DATABASE SYSTEM CONTD…

❖ The main characteristics of the database approach versus the


file-processing approach are the following:
✓ Self-describing nature of a database system
✓ Insulation between programs and data, and data abstraction
✓ Support of multiple views of the data
✓ Sharing of data and multiuser transaction processing

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 24


DATABASE USERS
❖ Database Administrators:
✓ In a database environment, the primary resource is the
database and the secondary resource is the DBMS and
related software
✓ Administering these resources is the responsibility of the
database administrator (DBA)
✓ Main responsibility is to authorize access to the database,
coordinating and monitoring its use, and acquiring software
and hardware resources as needed
✓ DBA is accountable for problems such as security breaches
and poor system response time

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 25


DATABASE USERS CONTD…
❖ Database Designers:
✓ Responsible for identifying the data to be stored in the
database
✓ Choosing appropriate structures to represent and store the
data
✓ The tasks are mostly undertaken before the database is
actually implemented and populated with data
✓ Database designers communicate with all prospective
database users in order to understand their requirements and
to create a design that meets these requirements

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 26


DATABASE USERS CONTD…

❖ End Users:
✓ Require access to the database for querying, updating, and
generating reports
✓ Database primarily exists for their use
✓ Categories of end users:
• Casual end users occasionally access the database, but
they may need different information each time; typically
middle- or high-level managers
• Naive or parametric end users constantly querying and
updating the database, using standard types of queries
and updates; Bank customers and tellers check account
balances and post withdrawals and deposits, Reservation
agents or customers for airlines

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 27


DATABASE USERS CONTD…
• Sophisticated end users include engineers, scientists, business
analysts who thoroughly familiarize themselves with the facilities of
the DBMS in order to implement their own applications to meet their
complex requirements
• Standalone users maintain personal databases by using ready-made
program packages that provide easy-to-use menu-based or graphics-
based interfaces; Personal finance data package
❖ System Analysts and Application Programmers (Software
Engineers):
✓ Determine the requirements of end users, specially naive and
parametric end users
✓ Develop specifications for standard transactions
• Application programmers implement these specifications as
programs; then they test, debug, document, and maintain the
transactions
Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 28
SCHEMAS, INSTANCES AND DATABASE STATE
✓ There is difference between the description of the database and the
database itself
✓ The description of a database is called the database schema, which is
specified during database design and is not expected to change frequently
✓ Most data models have certain conventions for displaying schemas as
diagrams
✓ A displayed schema is called a schema diagram
❖ Student
Student Name Student ID Class Course

❖ Course
Course Name Course ID Credit Hours Department Name

✓ Each object in the schema—such as STUDENT or COURSE is called as


a schema construct
Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 29
SCHEMAS, INSTANCES AND DATABASE STATE
CONTD…
✓ The actual data in a database may change quite frequently
For example,
Every time a new student is added
✓ The data in the database at a particular moment in time is called a
database state or snapshot
✓ It is also called the current set of occurrences or instances in the database

❖ Distinction between database schema and database state is:


✓ When a new database is defined , its database schema is specified
✓ At this point, the database state is the empty state with no data
✓ Initial state of the database is when the database is first populated or
loaded with the initial data
✓ From then on, every time an update operation is applied to the database,
another database state is obtained
✓ At any point in time, the database has a current state

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 30


THREE-SCHEMA ARCHITECTURE

✓ Three of the four important characteristics of the database approach are


• Self-describing nature of the database i.e. description (schema)
• Insulation of programs and data (program-data and program-
operation independence)
• Support of multiple user views
✓ The three-schema architecture helps in achieving these characteristics
✓ The goal of the three-schema architecture is to separate the user
applications from the physical database
✓ In this architecture, schemas can be defined at the following three levels:
• Internal level has an internal schema, which describes the physical
storage structure of the database
• It uses a physical data model and describes the complete details of
data storage and access paths for the database

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 31


THREE-SCHEMA ARCHITECTURE CONTD…

• Conceptual level has a conceptual schema, which describes the structure


of the whole database for a community of users
• The conceptual schema hides the details of physical storage structures and
concentrates on describing entities, data types, relationships, user
operations, and constraints
• External or view level includes a number of external schemas or user
views
• Each external schema describes the part of the database that a particular
user group is interested in and hides the rest of the database from that user
group

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 32


THREE-SCHEMA ARCHITECTURE CONTD…

Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 33


Dr. Sonali Chakraborty Email: chakrabartysonali@gmail.com 34

You might also like