Relational Database Management System

advertisement
Relational Database Management
System(17332)
CHAPTER -01
DATABASE SYSTEM CONCEPT
Prepared By
Ms. Harsha C. Kunwar
G.H. Raisoni Polytechnic, Nagpur
2015-16
Lecture - 1
An Introduction to Database
DATA :-
Data is anything in a form suitable for use with a computer.
Data is often distinguished from programs. A program is a Set of
instructions that detail a task for the computer to perform.
In this sense, data is thus everything that is not program code
Database :- A database is a collection of information that is organized so that it
can easily be accessed, managed, and updated.
DBMS :-
BACK
In database management system (DBMS), data files are the files that
store the database information, whereas other files, such as index
files and data dictionaries, store administrative information, known
as metadata.
2
Disadvantages of File Processing System
1.
Program-Data Dependence
2.
Duplication of Data.
3.
Limited data sharing.
4.
Lengthy Development Times.
5.
Excessive Program Maintenance.
BACK
3
List advantages of DBMS
1. Reduction in Redundancy: Duplication of records is reduced.
2. Avoiding Inconsistency: As the redundancy is reduced inconsistency is
avoided.
3. Maintaining Integrity: Accuracy is maintained.
4. Sharing of data: Sharing of data is possible.
5. Enforcement of Security: Security can be enforced.
6. Transaction support.
BACK
4
Lecture 02
DBMS Vs. RDBMS
BACK
5
Various DBMS And RDBMS Software
• RDBMS S/W:- db/2, mySQL, sql/server, Oracle
• DBMS S/W:-IBM’s IMS database, db/2, mySQL, sql/server,
Oracle,FOXPRO
BACK
6
Data Abstraction
Data Abstraction :- It is a process through the complicated details related to data
that how it is stored & maintained is hidden from the user
Three levels of abstraction are as follows:
1) Physical level
2) Logical level
3) View level
BACK
7
Contd..
1) Physical Level:
• It is lowest level of abstraction.
• This level defines lowest complicated data structure of database system.
• This level hidden from user.
• It defines how the data are stored.
2) Logical Level:
• The level next to physical level is called logical level.
• This level defines what data stored in the database and what the relationships
among these data .
• Fully decides the structure of the entire database.
3) View Level:
• This level is used to show the part of database to user.
• There is more complexity in physical as well as logical level so user should not
interact with complicated database.
• So different view of database can be created for user to interact with database
easily.
BACK
8
Lecture 03
Database Languages
There are three types of database languages
1.
Data Definition Language (DDL) commands provide means for defining
relation schema, deleting relations, creating indices, views and modifying
relation schemas.
E.g.
 CREATE TABLE/VIEW/INDEX to create a table/view/index in the
database
 DROP TABLE to remove a table from the database
 ALTER TABLE to add, modify or remove columns from a table in the
database
BACK
9
Contd..
2) Data Manipulation Language (DML) commands manipulates the data i.e.
they perform the operations of insertion, deletion, updating and selection of
data.
E.g.
 SELECT to select rows of data from a table
 INSERT to insert rows of data into a table
 UPDATE to change rows of data in a table
 DELETE to remove rows of data from a table
 RENAME to change the name of table
BACK
10
Contd..
3) Data Control Language(DCL):
• It is the component of SQL statement that control access to data and to
database.
• DCL commands are used to enforce database security in a multiple user
database
• environment. Two types of DCL commands are GRANT and REVOKE,
also COMMIT,
• ROLLBACK and SAVEPOINT used to provide the security. Only database
administrator’s
• or owners of the database object can provide/remove privileges on a
database object.
• E.g.
1. GRANT
2. REVOKE
3. COMMIT
4. ROLLBACK
5. SAVE POINT
BACK
11
Lecture 04
Instances & Schema
Instances :- The collection of information stored in the database at a particular
moment is called as an instance.
• The value of the variable declared in the program are corresponding to the
instance
Schema :- The overall design of the database is known as schema. The database
schema are partitioned at different level of abstraction.
• A database schema is related with the variable which are declared in the
program. Schema does not get changed frequently. The schema defined at
different level are as follows
 Physical Schema
 Logical Schema
 Sub Schema
BACK
12
Data Independence
Data Independence :- The ability to modify a schema definition in one level
without affecting a schema definition in next higher level is called data
independence.
There are two types of data independence
1. Physical data independence
2.Logical data independence.
1. Physical data independence :- Physical data independence is the ability to
change internal level without having change in conceptual or external level.
2. Logical data independence :- Logical data independence is the ability to
change conceptual level without having change in external level or application
program.
BACK
13
Lecture 05
Components of DBMS
Different components of DBMS are:
1.
Query Processor (DDL interpreter, DML compiler, Embedded DML PreCompiler, Query Evaluation Engine)
 DML Compiler : It translates DML statements of High level language
into low level instructions that query evaluation engine understands.
 Embedded DML Pre-Compiler: It converts DML statements embedded
in application program to
normal procedural calls in host language.
 DDL Interpreter: It interprets DDL statements and records them in a set
of tables containing
metadata.
 Query Evaluation Engine: It executes low level instructions generated by
DML compiler and
DDL interpreter.
BACK
14
Contd..
2. Storage Manager (Authorization and Integrity Manager, Transaction Manager,
File Manager, Buffer Manager)

Transaction Manager: It ensures that the database remains in consistent state despite the system
failures and that concurrent transaction execution proceeds without conflicting.

File Manager: It manages the allocation of space on disk storage& data structures used to
represent information stored on disk.

Buffer Manager: It is responsible for fetching data from disk storage into main memory and
deciding what data to cache in memory.
3. Disk Storage (Data Files, . Data Dictionary, Statistical data, indices)

Data Files : It stores the database.

Data Dictionary : It stores metadata about the structure of the database.

Indices : Provide fast access to data items that hold particular values.

Statistical Data : It stores statistical information about the data in the database. This information is
used by query processor to select efficient ways to execute query.
BACK
15
Lecture 06
Overall structure of DBMS
BACK
16
Lecture 07
Database Users
Types of users in DBMS
1. Application programmers or Ordinary users
2. End users
3. Database Administrator (DBA)
4. System Analyst
1. Application programmers or Ordinary users
 Application programmers are the users who write the program.
 These programmers use programming tools to develop the program.
 RAD technology is used to write the program.
2.
End Users
 End users are the users, who use the applications developed.
 End users need not know about the working, database design, the access
mechanism etc.
 They just use the system to get their task done.
 End users are of two types: a) Direct users b) Indirect users
BACK
17
Contd..
3. Database Administrator (DBA):
 Database Administrator (DBA) is the person which makes the strategic and
policy decisions regarding the data of the enterprise.
 Those who provide the necessary technical support for implementing the
decisions.
4.Sophisticated users
 Sophisticated users interact with the system by making the requests in the
form of query language.
 These queries are then submitted to the query processor.
 Query processor converts the DML statements into lower level interactions
which are understandable by storage manager.
 Some sophisticated users can be analyst.
5. Specialized users
 These users are not traditional.
 They write some special application programs which are not regular
applications.
 Example: such types of applications are CAD, knowledge based and expert
system.
BACK
18
Function Of DBA
1. Schema Definition
The Database Administrator creates the database schema by executing DDL
statements. Schema includes the logical structure of database table (Relation) like
data types of attributes, length of attributes, integrity constraints etc.
2. Storage structure and access method definition
The DBA creates appropriate storage structures and access methods by writing a
set of definitions which is translated by data storage and DDL compiler.
3. Schema and physical organization modification
DBA writes set of definitions to modify the database schema or description of
physical storage organization.
4. Granting authorization for data access
The DBA provides different access rights to the users according to their level.
Ordinary users might have highly restricted access to data, while you go up in the
hierarchy to the administrator, you will get more access rights.
5. Integrity constraints specifications
Integrity constraints are written by DBA and they are stored in a special file
which is accessed by database manager while updating data.
BACK
19
Client/Server Architecture
• The data processing is split into distinct parts. A part is either requester
(client) or provider (server).
• The client sends during the data processing one or more requests to the
servers to perform specified tasks.
• The server part provide services for the clients.
Server
Client
BACK
Request / Response
20
Contd..
Two tier Architecture
Two-tier Architecture consists of three components:
1) User system interface
2) Processing Management
3) Database Management
User System Interface provides friendly layer of
communication to make request of server and offer
multiple forms of inputs and outputs.
Processing
Management
includes
process
development, process implementation, monitoring
andresource services.
Database Management includes database and file
services two-tier client-server design derives
its name from how it distributes work between
client and server.
BACK
21
Cond…
Three tier architecture
• In three tier architecture the communication taken place from client to
application server and then application server to database system to access the
data. The application server or web server is sometimes called middle layer or
intermediate layer.
• The middle layer which processes applications an database server processes the
queries.
• This type of communication system is used in the large applications or the
world web applications.
• On WWW all clients requests for data and server serves it. There are multiple
servers used like fax server, proxy server, mail server
BACK
22
Contd..
Three tier architecture
23
12 Rules(Codd’s Law)
•
•
•
•
•
•
•
•
•
•
•
•
Rule 1: Information Rule
Rule 2: Guaranteed Access Rule
Rule 3: Systematic Treatment of NULL Values
Rule 4: Active Online Catalog
Rule 5: Comprehensive Data Sub-Language Rule
Rule 6: View Updating Rule
Rule 7: High-Level Insert, Update, and Delete Rule
Rule 8: Physical Data Independence
Rule 9: Logical Data Independence
Rule 10: Integrity Independence
Rule 11: Distribution Independence
Rule 12: Non-Subversion Rule
BACK
24
Lecture 08
Introduction to Distributed Database
• A distributed database (DDB) is a collection of multiple, logically
interrelated databases distributed over a computer network
•
A distributed database management system (DDBMS) is the software that
manages the DDB and provides an access mechanism that makes this
distribution transparent to the users
• Implicit assumptions
– Data stored at a number of sites each site logically consists of a single
processor
– Processors at different sites are interconnected by a computer network
– DDBS is a database, not a collection of files (i.e. relational data
model).
– DDBMS is a collections of DBMSs (not a remote file system)
BACK
25
Contd..
BACK
26
Introduction to Data Mining
• Data mining (knowledge discovery from data) KDD
– Extraction of interesting (non-trivial, implicit, previously unknown and
potentially useful) patterns or knowledge from huge amount of data.
• Alternative names
– Knowledge discovery (mining) in databases (KDD), knowledge
extraction, data/pattern analysis, data archeology, data dredging,
information harvesting, business intelligence, etc.
BACK
27
Data Mining architecture
BACK
28
What is Data Warehousing
Information
 A process of transforming data into
information and making it available to
users in a timely enough manner to
make a difference
 A data warehouse is a subject-oriented
Integrated , time-varying , non- volatile
collection of data that is used primarily
in organizational decision making.
Data
BACK
29
Contd..
BACK
30
MSBTE Asked Questions
• What is DBMS? Explain any two functions of DBMS.
(W-07)
• Explain
any
one
responsibility
of
database
manager.
(W-07)
• Explain the client server architecture.
(W-07)
• List the disadvantages of file processing system over DBMS.
(W-07)
• Define data abstraction and its level.
(S-08)
• What are components of DBMS?
(S-08)
• Explain overall structure of a DBMS.
(S-08)
• Explain in brief client-server architecture with example.
(S-08)
BACK
31
Contd..
•
•
•
•
•
•
•
•
•
•
•
•
List the advantages of DBMS. (w-08)
List the functions of database administrator.
(w-08)
Define data independence. List its type. (w-08)
What is data abstraction? Explain the levels of data abstraction. (s-08)
Explain type of database users. (s-08)
What is data independence? What are its types? (s-08)
Explain advantages of DBMS over file processing system. (s-08)
Define data and BBMS. (w-9)
List different database users. (w-9)
Explain two tier and three tier client/server architecture. (s-12)
Explain three level architecture with diagram. (w-9).
32
Download