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

L01-Introduction to Database

The document outlines a syllabus for a Database Management System course, focusing on key concepts such as E-R diagrams, relational databases, normalization, SQL commands, and transaction management. It also emphasizes practical laboratory work and project implementation, where students will apply their knowledge in database design and programming. Course objectives include analyzing information systems, designing databases, and demonstrating proficiency in SQL and PL/SQL.

Uploaded by

vidisha yadav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

L01-Introduction to Database

The document outlines a syllabus for a Database Management System course, focusing on key concepts such as E-R diagrams, relational databases, normalization, SQL commands, and transaction management. It also emphasizes practical laboratory work and project implementation, where students will apply their knowledge in database design and programming. Course objectives include analyzing information systems, designing databases, and demonstrating proficiency in SQL and PL/SQL.

Uploaded by

vidisha yadav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

UCS310: DATABASE

MANAGEMENT SYSTEM
1

I N T R O D U C T I ON T O D A T A B A S E
Syllabus
(L-T-P-Cr:3-0-2-4)

2
 Course Objectives: Emphasis is on the need of database systems. Main
focus is on E-R diagrams, relational database, concepts of normalization and
denormalization and SQL commands.

 Introduction: Data, data processing requirement, desirable characteristics of


an ideal data processing system, traditional file based system, its drawback,
concept of data dependency, Definition of database, database management
system, 3-schema architecture, database terminology, benefits of DBMS.

 Relational Database: Relational data model: Introduction to relational


database theory: definition of relation, keys, relational model integrity rules.

 Database Analysis: Conceptual data modeling using E-R data model -


entities, attributes, relationships, generalization, specialization, specifying
constraints, Conversion of ER Models to Tables, Practical problems based on
E-R data model.
Syllabus
(Continued)

3
 Relational Database Design: Normalization- 1NF, 2NF, 3NF, BCNF, 4NF
and 5NF. Concept of De-normalization and practical problems based on these
forms.

 Transaction Management and Concurrency control: Concept of


Transaction, States of Transaction and its properties, Need of Concurrency
control, concept of Lock, Two phase locking protocol.

 Recovery Management: Need of Recovery Management, Concept of Stable


Storage, Log Based Recovery Mechanism, Checkpoint.

 Database Implementation: Introduction to SQL, DDL aspect of SQL, DML


aspect of SQL – update, insert, delete & various form of SELECT- simple,
using special operators, aggregate functions, group by clause, sub query, joins,
co-related sub query, union clause, exist operator. PL/SQL - cursor, stored
function, stored procedure, triggers, error handling, and package.
Syllabus
(Continued)

4
 Laboratory work: Students will perform SQL
commands to demonstrate the usage of
 DDL and DML,
 joining of tables,
 grouping of data and will implement
 PL/SQL constructs.
 They will also implement one project.

Project: It will contain database designing & implementation, should


be given to group of 2-4 students. While doing projects emphasis should
be more on back-end programming like use of SQL, concept of stored
procedure, function, triggers, cursors, package etc. Project should have
continuous evaluation and should be spread over different components.
Syllabus
(Continued)

5
 Course Learning Outcomes (CLOs) / Course Objectives (COs):
On completion of this course, the students will be able to:
1. Analyze the Information Systems as socio-technical systems, its need and
advantages as compared to traditional file-based systems.
2. Analyze and design database using E-R data model by identifying
entities, attributes and relationships.
3. Apply and create Relational Database Design process with Normalization
and Denormalization of data.
4. Comprehend the concepts of transaction management, concurrence
control and recovery management.
5. Demonstrate use of SQL and PL/SQL to implementation database
applications.
Syllabus
(Continued)

6
Text Books:
1. Silverschatz A., Korth F. H. and Sudarshan S., Database System
Concepts, Tata McGraw Hill (2010) 6th ed.
2. Elmasri R. and Navathe B. S., Fundamentals of Database Systems,
Pearson (2016) 7th ed.

Reference Books:
1. Bayross I., SQL, PL/SQL the Programming Language of Oracle, BPB
Publications (2009) 4th ed.
2. Hoffer J., Venkataraman, R. and Topi, H., Modern Database
Management, Pearson (2016) 12th ed.
3. Parteek Bhatia and Gurvinder Singh, Simplified Approach to DBMS.
7

Introduction to Database
Data
8

 Data comes from the Latin word datum, meaning


“something given.” Over the time, the English
language has evolved to use data as plural.

“Data is the raw fact and figures that can be


recorded, stored and processed by any computing
machine.”

 When we talk about data, we think of megabytes of


binary code.
 Data can be any character, text, words, number,
pictures, sound, video etc.
Data
9

 Data may be numerical data which may be integers


or floating point numbers, and non-numerical data
such as characters, date and etc.,

The above numbers may be anything: It may be distance in kms or amount


in rupees or no of days or marks in each subject etc.,
Information
10

 Information is RELATED DATA


Information
11

 The word ‘Information’ is derived from latin word


‘Informare’, which means ‘to instruct’.
 The word information has existed in the English
language for far longer than the word data.
 When data is processed, organized, structured or
presented in a given context so as to make it useful, it is
called information.
 Ex1:
 Data: Shyam, 85, Physics, Marks, Scored, in.
 Information: Shyam scored 85 marks in Physics.
 Ex2:
 Each student's test score is one piece of data.
 The average score of a class or of the entire school is information
that can be derived from the given data.
Difference between Data and Information
12
13

 Data: I have one item. The


data displays a 1, not a zero.
 Information: It’s a
tomato. Now, we understand
the item and its
characteristics.
 Knowledge: A tomato is a
vegetable.
 Wisdom (Decision
making): Tomato is never
added to a fruit salad.
How we Store data?
14

 A data store is a repository for storing collections of


data, such as a database, a file system or a directory.

 File System

 Database
File System
15

 File: A collection of records or documents dealing


with one organization, person, area or subject
 Manual (paper) files
 Computer files
Various Types of files
16

Depending upon the type of content, a file can be


categorized as:

1. Data file
2. Program file
3. Object code file
4. Executable file
5. Text file
File System
17

 A file is just a sequence of bytes of information.

 The contents of a file is determined and interpreted by


programs, not the operating system.

 A file system is the method and data structure that an operating


system uses to keep track of files on a disk or partition.
or
 A file System is the software that provides hierarchical storage
and organization of files, usually on a single computer – part of
the operating system
18
Managing Files
19

 Logical Structure: users and programs see a hierarchy of


folders (or directories) and files
 Folder:
 a folder contains references to folder and files
 "root" folder ultimately leads to all others
 a folder is a special file that contains names of other folders & files plus
other information like size, time of change, etc.
 contents are completely controlled by the operating system

 Physical Structure: disk drives operate in tracks,


sectors, etc. (other storage devices have other physical
properties)
 Disks:
 A place to store information when the power is turned off
 Usually based on magnetic surfaces, rotating machinery
20
Managing Files(cntd..)
21

 The operating system converts between these two


views
 does whatever is necessary to maintain the file/folder illusion
 hides physical details so that programs don't depend on them
 presents a uniform interface to disparate physical media
 "file system" is the part of the operating system that
does this conversion
Database System vs. File System

Figure 1.6

22
Drawbacks of File Systems
23

 Consider a bank want to keep information about all the


saving accounts
 The bank is using file system
 To allow users to manipulate information, the system has a number of
application programs, that manipulates the files,
 Example:
 A program to debit or credit an account
 A program to add a new account
 A program to find the balance of an account
 A program to generate monthly statement
Suppose, A bank decides to offer current account. For this bank will
create new permanent files to store information of checking account
and also new application program for checking accounts. Such as
A program to check overdraft(Withdrawing more money than
balance)

This will lead to More Files and More Programs with time
Disadvantages of File System
24

1. Data Redundancy
 The files are created in the file system as and when required
by an enterprise over its growth path. So in that case the
repetition of information about an entity cannot be avoided.

Eg. The addresses of customers will be present in the file


maintaining information about customers holding savings
account and also the address of the customers will be present
in file maintaining the current account. Even when same
customers have a saving account and current account his
address will be present at two places.
2. Inconsistency
25

Data redundancy leads to greater problem than just


wasting the storage i.e. it may lead to inconsistent
data. Same data which has been repeated at several
places may not match after it has been updated at
some places.

For example: Suppose the customer requests to change the


address for his account in the Bank and the Program is executed to
update the saving bank account file only but his current bank
account file is not updated. Afterwards the addresses of the same
customer present in saving bank account file and current bank
account file will not match. Moreover there will be no way to find
out which address is latest out of these two.
3. Difficulty in Accessing Data
26
 Suppose that one of the bank officers needs to find out the names of all
customers who live within a particular postal-code area. The officer asks the
data-processing department to generate such a list. Because the designers of
the original system did not anticipate this request, there is no application
program on hand to meet it. There is, however, an application program to
generate the list of all customers. The bank officer has now two choices:
 either obtain the list of all customers and extract the needed information
manually or
 ask a system programmer to write the necessary application program.

 Both alternatives are obviously unsatisfactory.


 Suppose that such a program is written, and that, several days later, the same
officer needs to trim that list to include only those customers who have an
account balance of $10,000 or more. As expected, a program to generate such
a list does not exist. Again, the officer has the preceding two options, neither
of which is satisfactory.
4. Data Isolation
27

 Since the data files are created at different times and


by different people, the structures of different files
generally will not match. The data will be scattered
in different files for a particular entity.

For example: Suppose the Address in Saving Account file have


fields: Add line1, Add line2, City, State, Pin while the fields in address of
Current account are: House No., Street No., Locality, City, State, Pin.
Administrator is asked to provide the list of customers living in a
particular locality. Providing a list of all the customers will require looking
in both files. But they both have different way of storing the address.
Writing a program to generate such a list will be difficult.
5. Integrity Problems
28

 Data integrity is the overall accuracy, completeness,


and consistency of data.
 All the consistency constraints have to be applied to database
through appropriate checks in the coded programs. This is
very difficult when number of such constraint is very large.
For example:
 An account should not have balance less than Rs. 500.
 To enforce this constraint appropriate check should be added in the
program which add a record and the program which withdraw from an
account.
 Suppose later on this amount limit is increased then all those check
should be updated to avoid inconsistency.
 These time to time changes in the programs will be great headache for
the administrator.
6. Atomicity
29

 It is difficult to ensure atomicity in file processing


system.
 Atomicity means: Execute all the operations of a transaction
or none of them. (All OR None)

 For example: transferring $100 from Account A


to account B. If a failure occurs during execution
there could be situation like $100 is deducted from
Account A and not credited in Account B.
7. Concurrent Access anomalies
30

 If multiple users are updating the same data


simultaneously it will result in inconsistent data
state.
 In file processing system it is very difficult to handle
this using program code.
 This results in concurrent access anomalies.
8. Security Problems
31

 Enforcing Security Constraints in file processing


system is very difficult as the application programs
are added to the system in an ad-hoc manner.

 For example:
 The Payroll Personnel in a bank should not be allowed to
access accounts information of the customers.
 Student should not allowed to access information about
administration data.
Database Management System
32

 Database is a collection of related data and data is a


collection of facts and figures that can be processed to
produce information.
 If we have data about marks obtained by all students
We can then conclude about toppers and average marks
 We can calculate percentage marks obtained by a student
 We can print marks sheets
 A database management system(DBMS) is a set of programs that is
used to access, modify and extract information from a database
 The DBMS stores data in such a way that it becomes easier to retrieve,
manipulate, and produce information.
 The general purpose of a DBMS is to provide for the definition,
storage, and management of data that can be shared by
many users.
Database Management System
33

 The related information when placed is an organized


form makes a database.

 Database is a collection of information organized in


such a way that a computer program can quickly
select desired pieces of data.

 The organization of data/information is necessary


because unorganized information has no meaning
DBMS Manages Interaction

34
Operations on Databases
35
Components of the DBMS Environment
36
Users of DBMS
37

 Administrators:
 Administrators maintain the DBMS and are responsible for
administrating the database.
 They are responsible to look after its usage and by whom it
should be used.
 They create access profiles for users and apply limitations to
maintain isolation and force security.
38

 Database Designers:
 Designers are the group of people who actually
work on the designing part of the database.
 They keep a close watch on what data should be
kept and in what format.
 They identify and design the whole set of entities,
relations, constraints, and views.
39

 End Users:
 End users are those who actually takes the benefits of having a
DBMS.
 The End user can be of following types:
 On-line user: The user can directly access the database through
online-terminal or user interface. They know the presence of the
database and can manipulate database using SQL language.
 Naïve User: The users who does not have deep knowledge about
the database. These users uses the database through menu oriented
application programs.
 Programmer: The user of database who develop the application
programs for the On-line users and Naïve users.
Use of DBMS
40

Databases are widely used. Here are some


applications of database:
 University database: To store information details about
Students, Faculties, Courses etc.
 Banking: To store customer information, accounts, loans,
transactions etc.
 Credit card transaction: For purchases on credit card and
generation of monthly bill statements
 Airline: For reservation and schedule information.
 Airlines were first to use databases.
 The terminals situated around the world accessed the central
database through phone lines and data networks.
Use of DBMS
41

 Library: To store information about books, journals etc.


 Telecommunication: For keeping records of calls/sms made,
generating monthly bills, maintaining balance for prepaid calling,
storing information about communication networks
 Human Resources: For information about employees, salaries,
benefits etc.
 Hospital: To store information about patients, doctors, staffs,
department, equipments, etc
 Pharmacy: To store information about medicines.
 E-commerce: For information about products, customers,
Offers etc.
Arrangement of Data in Database
42

Bit Binary digit 0 or 1

Byte A Logical collection of bits

Data Item/ Field A Logical collection of bytes


Record Collection of relevant fields
Table Collection of Similar Records
Table Name
Field (Data item)
Salary (File)

Sr. No. Name Basic DA HRA Total


1. Mayank 10,000 2500 100 12600
2. Hiten 12,000 2000 200 14200 Record
3. Ram 15,000 4000 100 19100

Data

43
Advantages of DBMS
44
Advantages of DBMS
45
Disadvantages of DBMS
46
DBMS Architecture
47

 The design of a DBMS depends on its architecture.


 It can be centralized or decentralized or hierarchical.
 The architecture of a DBMS can be seen as either
single tier or multi-tier.
 An n-tier architecture divides the whole system into
related but independent n modules, which can be
independently modified, altered, changed, or
replaced.
1-tier architecture
48

 In 1-tier architecture, the DBMS is the only entity


where the user directly sits on the DBMS and uses it.
 Any changes done here will directly be done on the
DBMS itself.
 Database designers of the database normally prefer to
use single-tier architecture.
 1-tier architecture is simple and cheap,
but usually unsecured and data can
easily be lost if you are not careful.
2-tier architecture
49

 This architecture is also called Client-Server


architecture because of the two components: The
client that runs the application and the server that
handles the database back-end.
 If the architecture of DBMS is 2-tier, then it must have
an application through which the DBMS can be
accessed.
 Programmers use 2-tier architecture where they
access the DBMS by means of an application.
 Here the application tier is entirely independent of the
database in terms of operation, design, and
programming.
50
3-tier architecture
51

 A 3-tier architecture separates its tiers from each


other based on the complexity of the users and how
they use the data present in the database.
 It is the most widely used architecture to design a
DBMS.
52
 Database (Data) Tier:
 At this tier, the database resides along with its query processing languages.
 We also have the relations that define the data and their constraints at this level.
 The database tier is not aware of any other user beyond the application tier.

 Application (Middle) Tier/Business Logic Tier:


 At this tier reside the application server and the programs that access the
database.
 For a user, this application tier presents an abstracted view of the database.
 The application layer sits in the middle and acts as a mediator between the end-
user and the database.

 User (Presentation) Tier/ Client Tire:


 End-users operate on this tier and they know nothing about any existence of
the database beyond this layer.
 At this layer, multiple views of the database can be provided by the
application.
 All views are generated by applications that reside in the application tier.
Data Abstraction
53

 A database system is the collection of interrelated data


and set of programs that allows users to access and
modify these data.
 The database system can be meaningful only if it provide
data retrieval efficiently.
 To make database efficient designer has to used complex
data structure to maintain the records/files in the
database.
 Since not all the database users are trained, developers
hides the complexity from the users.
 That is , the system hides certain details of how the data
are stored and maintained.
Three Levels of Abstraction

View Level
What data users and
application programs
see ?
View 1 View 2 … View n

What data is stored? Logical


describe data properties such as Level
data semantics, data relationships

How data is actually stored?


e.g. are we using disks ? Which Physical
file system ? Level
55
Physical Level
56

 It is the lowest level of Abstraction.


 Describes how the data are actually stored.
 Deals with the Data Structure Details.
Logical Level
57

 This level describes what data stored in database


and what relationship exist among those data.
 ER-Diagram( Schema of database)

 The user of the logical level does not need to be


aware of the complexity of the physical level.
View Level
58

 The highest level of abstraction.


 Describes what data users and application programs
should see.
 Many user (Naïve users, online users, programmers)
does not need all the information about details of the
logical level. They only need their parts of the
database.
 The view level simplify the users interactions with the
database system.
Data Independence
59

 If a database system is not multi-layered, then it


becomes difficult to make any changes in the
database system.
 Database systems are designed in multi-layers(View,
Logical, Physical).
Logical Data Independence
60

 Logical data is data about database, that is, it stores


information about how data is managed inside.
 For example, a table (relation) stored in the database
and all its constraints, applied on that relation.

 Logical data independence is a kind of mechanism,


which liberalizes itself from actual data stored on the
disk.
 If we do some changes on table format, it should not
change the data residing on the disk.
Physical Data Independence
61

 All the schemas are logical, and the actual data is stored in bit format on the
disk.
 Physical data independence is the power to change the physical data without
impacting the schema or logical data.
 i.e the ability to modify the physical schema without changing the logical
schema

 For example, in case we want to change or upgrade the storage system itself −
suppose we want to replace hard-disks with SSD − it should not have any
impact on the logical data or schemas.
 (Solid State Drive (SSD), Hard Disk Drive (HDD))

 Applications depend on the logical schema.


 In general, the interfaces between the various levels and components should be
well defined so that changes in some parts do not seriously influence others.
Data Model

 Data models define how the logical structure of a


database is modeled.
 Data models define how data is connected to each
other and how they are processed and stored inside
the system.
 There are two types of data models:
 Entity –Relationship Model
 Relational Model

Both provides a way to describe the design of a database at the


logical level
Entity-Relationship(ER) Model

 Entity-Relationship (ER) Model is based on perceptions


of real-world entities and relationships among them.
 While formulating real-world scenario into the database
model, the ER Model creates
 entity set,
 relationship set,
 general attributes and
 constraints.

 ER Model is best used for the conceptual design of a


database.
 ER Model is based on −
 Entities and their attributes.
 Relationships among entities.
Relationship Model

 Relational model uses a collection of tables to


represent both data and relationships among those
data.
 Each table has multiple columns and each column has
unique name.

 The database design is carried out in E-R model then


translated to the Relational model.
66

E-R diagram

Relational database

You might also like