Dbms Project
Dbms Project
DBMS
System crashes:
What is the problem ?
Large data sets (say 50GB)
Why is this a problem ?
Simultaneous access by many users
Lock students.txt – what is the problem ?
Functions of DBMS
The ability to retrieve and update data
Supporting concurrent updates
Recovery of data
Security
Data integrity
Interactive query
Interactive data entry and updating
ADVANTAGES OF DBMS
Database damage
DBMS
•
Bank Business
Database system Applications
Airlines Universities
DATA MODELS
• A data model is a collection of conceptual tools
for describing data, data relation-ship, data
semantics, and consistency constraints. In this
part, we study two data models
the E-R (entity relationship) model
and the relational model .
RDBMS
Relational database management system (RDBMS) is a
database management system (DBMS) that is based on
the relational model as introduced by E. F. Codd. Most
popular databases currently in use are based on the
relational database model.
Example
Relational languages
SQL
QBE
Datalog
ER Model
The E-R data model perceives the real world as
consisting of basic objects, called entities, and
relationships among these objects.
Entity Sets
Relationship Sets
Attributes
E-R Diagram
RELATIONSHIP SETS
A Relationship is an associations among several
entities.
Mapping Cardinalities
One to One
One to Many
Many to One
Many to Many
RELATIONAL SETS
o DBMS ARCHITECTURE
connection
(ODBC, JDBC)
Database server
Data files (someone else’s
Applications
C program)
25
Three Level Architecture of DBMS
A major purpose of a database system is to provide
users with an abstract view of the data. That is,
the system hides certain details of how the data is
stored and maintained.
External
Level View 3
View 1 View 2
Conceptual level
Physical level
THREE LEVEL ARCHITECTURE OF DBMS
View 1 View 2
External Item_Name Item_Name
level Price Stock
Conceptual
Conceptual level level Item_Number Character (6)
Item_Name Character(30)
Price Numeric(5,2)
Stock Numeric(4)
Physical
Stored_Item Length=50
Item # Type = Byte(6), offset = 0, Index = Ix
Physical level Name Type = Byte(30), offset = 6
Price Type = Byte(8), offset = 36
Stock Type = Byte(4), offset = 44
External or View Level
This level is closest to the users and is concerned with the way
in which the data is viewed by individual users. Most of the
users are not concerned with all the information contained in
the database. Instead they need only a part of the database
relevant to them. The system provides many views for the
same databa
External or View Level
Database
Manager
File
Manager
What is SQL?
When a user wants to get some information from a
database file, he can issue a query
A query is a user–request to retrieve data or
information with a certain condition.
SQL is a query language that allows user to specify
the conditions. (instead of algorithms)
INTRODUCTION TO SQL
Concept of SQL
The user specifies a certain condition
The program will go through all the records in the database file
and select those records that satisfy the condition.(searching).
Statistical information of the data.
The result of the query will then be stored in form of a table.
Basic structure of an SQL query
General SELECT, ALL / DISTINCT, *,
Structure AS, FROM, WHERE
Union UNION
THE SITUATION:
STUDENT PARTICULARS
field type width contents
id numeric 4
student id number
name character 10 name
dob date 8 date of birth
sex character 1 sex: M / F
class character 2 class
hcode character 1 house code: R,
Y, B, G
dcode character 3 district code
remission logical 1 fee remission
mtest numeric 2 Math test score
General Structure
SELECT ...... FROM ...... WHERE ......