2. Introduction to DBMS
ďWhat is Database?
ďPurpose of Database Systems
ďFile System vs. DBMS
ďView of Data
ďData Models
ďRDBMS
ďDDL
ďDML
ďDCL
ďTCL
MJS-15 Index
3. MJS-15 Introduction
1
⢠A software used to manage data.
⢠A very large, integrated collection of data.
⢠A collection of information stored in a computer in
a systematic way.
Databases
⢠MySql
⢠Postgresql
⢠Oracle
What is Database..?
4. Database Management System
(DMBS)
ďCollection of interrelated data
ďDMBS contains information about a particular
enterprise
ďDBMS provides an environment that it both
convenient and efficient to use
MJS-15 Introduction
2
5. File System vs. DBMS
advantages disadvantages
FMS ⢠Simpler to use
⢠Less expensive
⢠Typically no multi-user access
⢠Limited to smaller databases
⢠Limited functionality
⢠Decentralization of data
⢠Redundancy and integrity issues
DBMS ⢠Greater flexibility
⢠Greater processing power
⢠Ensures data integrity
⢠Supports simultaneous
access
⢠Provides backup and
recovery controls
⢠Advanced security
⢠Difficult to learn
⢠Packaged separately from the
OS
⢠Slower processing speeds
⢠Requires skilled administrators
⢠Expensive
MJS-15 Introduction 3
6. Purpose of Database Systems
ďData redundancy and inconsistency
ďDifficulty in accessing data
ďData isolation â multiple files and formats
ďIntegrity problems
ďConcurrent access by multiple users
ďSecurity problems
MJS-15 Introduction 4
Database management systems were developed
to handle the following difficulties of typical file-
processing systems supported by conventional
operating systems:
7. View of Data
An architecture for a database system
MJS-15 Introduction 5
Physical
level
Logical
level
View
level
8. Levels of Abstraction
ďPhysical level: describes how a record (e.g.
customer) is stored.
ďLogical level: describes data stored in database,
and the relationships among the data.
type customer = record
name: string;
street: string;
city: integer;
end;
ďView level: application programs hide details of
data types. Views can also hide information (e.g.
salary) for security purposes.
MJS-15 Introduction 6
9. Instances and Schemas
ďSimilar to types and variables in programming languages
ďSchema â the logical structure of the database (e.g., set
of customers and accounts and the relationship between
them)
ďInstance â the actual content of the database at a
particular point in time
MJS-15 Introduction 7
10. Data Models
ďA collection of tools for describing:
ďData relationships
ďData constraints
ďObject-based logical models
ďEntity-relationship model
ďRecord-based logical models
ďRelational model (e.g., SQL/DS, DB2)
MJS-15 Introduction 8
11. Entity-Relationship Model
Example of entity-relationship model
MJS-15 Introduction 9
customer accountdepositor
social-security customer-street
customer-name
account-number
balancecustomer-city
12. What is RDBMS..?
MJS-15 Introduction 10
⢠RDBMS stands for Relational Database
Management System.
⢠RDBMS data is structured in database tables,
fields and records.
⢠In this data will be stored in the from rows and
columns.
⢠RDBMS also provide relational operators to
manipulate the data stored into the database
tables.
13. Relational Model
Example of tabular data in the relational model:
MJS-15 Introduction 11
name ssn street city account-number
Johnson 192-83-7465 Alma Palo Alto A-101
Smith 019-28-3746 North Rye A-215
Johnson 192-83-7465 Alma Palo Alto A-201
Jones 321-12-3123 Main Harrison A-217
Smith 019-28-3746 North Rye A-201
account-number balance
A-101 500
A-201 900
A-215 700
A-217 750
14. MJS-15 Introduction 12
There are four types of query languages as follows.
â˘Data Definition Language (DDL)
â˘Data Manipulation Language (DML)
â˘Data Control Language (DCL)
â˘Transaction Control (TCL)
RDBMS Query Languages.
15. Data Definition Language (DDL)
A DDL is a language used to define data structures and
modify data.
DDL Commands:
â˘Create
â˘CREATE TABLE employee(empID int, Ename char(20), Esalary int, Eadd varchar(25));
â˘Alter
â˘ALTER TABLE employee ADD Ecountry varchar (50);
â˘Drop
â˘DROP TABLE employee;
â˘Truncate
⢠TRUNCATE TABLE employee;
â˘Rename
â˘SELECT Ename AS Emp_name FROM employee;
MJS-15 Introduction 13
16. Data Manipulation Language
(DML)
A DML is a language used for managing data in
database.
DML Commands:
â˘Select
⢠SELECT * FROM employee;
â˘Insert
â˘INSERT INTO employee(EmpId, Ename, Esalary, Ecity)
VALUES (502 ,âsandeep',â25000',hyderabad' );
â˘Update
â˘UPDATE employee SET Ename=âbharath', where Ecity=hyderabd';
â˘Delete
â˘DELETE FROM Employee WHERE Ename=âsandeepâ;
MJS-15 Introduction 14
17. Data Control Language (DCL)
A DCL is a language used to control privilege in
Database
DCL Commands:
â˘Grant
â˘Syntax: REVOKE [permission] ON database.table FROM 'userâ@'localhost';
Example: GRANT [write] ON [company_details].[employee] TO â[sandeep]â@'localhostâ;
â˘Revoke
â˘Syntax: REVOKE [permission ]ON database.table FROM 'userâ@'localhost';
Example: REVOKE [write] ON Company_details.Employee FROM âSandeep'@'localhost';
MJS-15 Introduction 15
18. Transaction Control Language (TML)
A TCL is a language used to manage transactions in
database
TCL Commands:
â˘Commit : save work done
â˘Syntax: commit
â˘Rollback : restore database to original since the last COMMIT
â˘Syntax: rollback;
MJS-15 Introduction 16
Database changes over time when information is inserted or deleted. The collection of information stored in the database at a particular moment is called an instance of the database