rdbms session 1
Post on 09-Apr-2018
226 Views
Preview:
TRANSCRIPT
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 2/40
Introduction
Organizations often maintain large amounts of data,
which are generated as a result of day-to-dayoperation. A database is an organized form of suchdata. It may consist of one or more related dataitems called records.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 3/40
Data and Database
Data means information.
It can be any information such as information aboutthe vehicle, sports, id so on.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 4/40
A database is a collection of data. Some like to
think of a database as an organized mechanism thathas the capability of storing information. Thisinformation can be retrieved by the user in aneffective and efficient manner.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 5/40
Thus, a database is a collection of data that isorganized such that its contents can be easilyaccessed managed, and updated.
Database
User
Store Information
Access Information
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 6/40
Data Management
Data management deals with managing large
amount of information, which involves both thestorage of information and the provision of mechanisms for the manipulation of information. Inaddition, the system should also provide the safety.
The two different approaches of managing data arefile-based systems and database systems.
File based systems
Database systems
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 7/40
File-based Systems
Storage of large amounts of data has always been a
matter of huge concern.
In early days, file-based system, that is systems inwhich data was stored in discrete files, were used.
In this system, a bunch of file was stored on acomputer and could be accessed by a computeroperator. Files of archived data were called tablesbecause they looked like tables used in traditionalfile keeping. Rows in the table were caked recordsand columns were called fields.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 8/40
An example of the file-based system is illustrated in
Table.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 9/40
Disadvantages of File-based Systems
In a file-based system, different programs in the
same application may be interacting with differentprivate data files.
There is no system enforcing any standardizedcontrol on the organization and structure of these
data files.
± Data Redundancy and Inconsistency
± Unanticipated Queries
±
Data Isolation ± Concurrent Access Anomalies
± Security Problems
± Integrity Problems
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 10/40
Database Systems
Database Systems evolved in the late 1960s to
address common issues in applications handlinglarge volumes of data.
Databases are used to store data in an efficient and
organized manner. A database allows quick andeasy management of data.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 11/40
Advantages of database systems
Information or data can be permanently stored inthe form of computerized databases. A databasesystem is advantageous because it provides acentralized control over the data.
Benefits
± The amount of redundancy in the stored data canbe reduced
± No more inconsistencies in data
± The stored data can be shared
± Standards can be set and followed
± Data Integrity can be maintained
± Security of data can be implemented
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 12/40
Database Management System (DBMS)
A Database Management System can be defined as
a collection of related records and a set of programsthat access and manipulate these records.
A Database Management System enables the userto enter store and manage data.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 13/40
USER/PROGRAMMERS
DATABASE
SYSTEMS
APPLICATION PROGRAMS/QUERIES
DBMS
SOFTWARE
Software to processQueries/Programs
Software to Access Stored Data
Database Database
Fig A Simplified Database System Environment
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 14/40
Benefits of DBMS ± Data Storage
± Data Definition
± Data Manipulation ± Data Security and Integrity
± Data Recovery and Concurrency
± Performance
± Multi-user Access Control
± Database Access Languages and ApplicationProgramming Interfaces
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 15/40
Database Models
A data model describes a container for storing data,
and the process of storing and retrieving data fromthat container.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 16/40
Flat-file Data Model
In this model, the database consists of only onetable or file.
This model is used for simple databases forexample, to store the roll numbers, names,subjects, and marks of a group of students.
This model cannot handle very complex data.
It can cause redundancy when data is repeatedmore than once. Table depicts the structure of a flatfile database.
Roll No FName LName Subject Marks45 Jones Bill Maths 84
45 Jones Bill Science 75
50 Mary Mathew Science 80
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 17/40
Hierarchical Data Model
In the hierarchical Model. different records are
inter-related through hierarchical or tree-likestructures.
In this model, relationships are thought of in termsof children and parents.
A parent record can have several children, but achild can have only one parent.
To find data stored in this model, the user needs toknow the structure of the tree.
Examples of the hierarchical data model areWindows directory management system visiblethrough the Windows Explorer
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 18/40
DEPARTMENT
D_Name D_Number MGRNAME MGRSTARTDATE
PROJECT
PNAME PNUMBER PLOCATION
EMPLOYEE
NAME SSN ADDRESSBDATE
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 19/40
a. DEPARTMENT:
EMPLOYEE:
Research
Smith Max John Grace
Administration
Elite James Frank
b. DEPARTMENT:
PROJECT
Research
Product A Product B
Administration
Computerization New benefits
Figure - Hierarchical Schemas
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 21/40
Network Data Model
This model is similar to the Hierarchical Data Model.
In the network model the child tables were allowedto have more than one parent.
In the network model, data is stored in sets,instead of the hierarchical tree format. This solvesthe problem of data redundancy.
It allows a child to have more than one parent.Thus, the records are physically linked throughlinked-lists.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 22/40
Salesrep Customer
invoice payment
Figure : The Network Model
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 23/40
The components of the language used with networkmodels are:
1. A Data Definition Language (DDL) that is used tocreate and remove databases and database objects.It enables the database administrator to define theschema components.
2. A Data Manipulation Language (DML), which is usedto insert, retrieve and modify database information.All database users use these commands during the
routine operation of the database.
3. Data Control Language (DCL), is used to administerpermissions on the databases and database objects.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 24/40
Advantage of Network Model
The advantages of such a structure are specified as
follows:
± The relationships are easier to implement in thenetwork database model than in the hierarchical
model.
± This model enforces database integrity.
±
This model achieves sufficient dataindependence.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 25/40
Disadvantages of Network Model
The advantages are specified as follows:
± The databases in this model are difficult to design.
± The programmer has to be very familiar with theinternal structures to access the database.
± The model provides a navigational data accessenvironment. Hence, to move from A to E in thesequence A-B-C-D-E, the user has to move through B,
C, and D to get to E.
This model is difficult to implement and maintain.Computer programmers, rather than end users, utilizethis model.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 26/40
Relational Data Model
The term µRelation¶ is derived from the set theory of
mathematics. In the Relational Model, unlike theHierarchical and Network models, there are nophysical links. All data is maintained in the form of tables consisting of rows and columns.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 27/40
Data in two tables is related through commoncolumns and not physical links. Operators areprovided for operating on rows in tables. The
popular relational DBMSs are Oracle, Sybase, DB2,MS-SQL Server and so on.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 28/40
In order to understand the relational model, considerTable µA¶ and Table µB¶.
Roll Number Student Name
1 Sam
2 John
3 Jenny
4 Lisa
5 Penny
6 Peter
7 Joe
Roll Number Marks Obtained
1 34
2 87
3 45
4 90
5 36
6 65
7 89
Table µA¶ Table µB¶
Students Table Marks Table
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 29/40
Figure shows two tables related to another througha common key (data value) in a relational database.
Relationship
TABLE 1
Key
Data
TABLE 2Key
Data
Figure Relationship between tables
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 30/40
The capitals tables shown in Table µE¶ displays a listof countries and their capitals, and the Currencytable shown in Table µF¶, displays the countries and
the local currencies used by them.
Country Capital
Greece Athens
Italy Rome
USA Washington
China Beijing
Japan Tokyo
Australia Sydney
France Paris
Country Currency
Greece Drachma
Italy Lira
USA Dollar
China Renminbi (Yuan)
Japan Yen
Australia Australian Dollar
France Francs
Table E - CapitalTable F - Currency
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 31/40
Terms related to RDBMS
Data is presented as a collection of relations.
Each relation is depicted as a table. Columns are attributes.
Rows (³tuples´) represent entities.
Every table has a set of attributes that are taken
together as a ³Key´ (technically, a ³superkey´),which uniquely identifies each entity.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 32/40
Cust_No Cust_Name Phone No
002 David 0231-5466356
003 Prince 0221-5762382
003 Charles 0321-8734723
002 Ryan 0241-2343444
005 Bruce 0241-8472198
Table G - Customer
Item_No Description Price
HW1 Power Supply 4000
HW210-K
eyboard 2000
HW3 Mouse 800
SW1 MS_DOS 6.0 5000
SW2 MS_Word 6.0 8000
Table H - Items
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 33/40
Ord_No Item_No Qty
101 HW3 50
101 SW1 150
102 HW2 10
103 HW3 50
104 HW2 25
104 HW3 100
105 SW1 100
Table H Order_Details
Ord_No Ord_Date Cust_No101 02-08-06 002
102 11-08-06 003
103 21-08-06 003
104 28-08-06 002
105 30-08-06 005
Table I Order_August
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 34/40
Term Meaning Example from the given
Case Example
Relation A table Order_August,
Order_Details, Customer
and Items
Tuple A row or a record in a
relation
A row from Customer
relation is a Customer
tuple.
Attribute A field or a column in
a relation.
Ord_Date, Item_No,
Cust_Name and so on.
Cardinality of
a relation
The number of tuples
in a relation
Cardinality of
Order_Details relation is 7.Degree of a
relation
The number of
attributes in a relation
Degree of Customer
relation is 3.
Table J Terms related to tables
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 35/40
Term Meaning Example from the given
Case Example
Domain of an
attribute
The set of all values
that can be taken by
the attribute
Domain of Qty in
Order_Details is the set of
all values which can
represent quantity of an
ordered item.
Primary keyof a relation
An attribute or acombination of
attributes that
uniquely defines each
tuple in a relation.
Primary Key of Customerrelation is Cust_No.
Ord_No and Item_No
combination forms the
primary Key of
Order_Details.
Table J Terms related to tables
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 36/40
Term Meaning Example from the given
Case Example
ForeignK
ey An attirbute or acombination of attribute
in one relation R1 which
indicates the relationship
of R1 with another
relation R2.
The foreign key attributes
in R1 must contain values
matching with those of
the values in R2.
Cust_No in Order_Augustrelation is a foreign key
creating reference from
Order_August to Customer.
This is required to indicate
the relationship betweenorders in Order_August and
Customer.
Table J Terms related to tables
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 37/40
Emp_No Emp_Name Emp_DOB Emp_DOJ
345 James 24-Sep-1968 30-May-1990
873 Pamela 27-Jul-1970 19-Nov-1993
693 Allan 10-Sep-1970 01-Jul-1992
305 Geoff 12-Feb-1973 29-Oct-1996
Figure Characteristics of Tables
Table
EMPLOYEE
Attributes
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 38/40
The Characteristics of table are:
± A two-dimensional structure composed of towsand columns is perceived as a table.
± Each tuple represents a single entity within theenitity set.
± Each column has a distinct name.
± Each row/column intersection represents a singledata value.
± Each table must have a key known as primarykey that uniquely identifies each row.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 39/40
± All values in a column must conform to the samedata format. For example, if the attribute isassigned a decimal data format, all values in the
column representing that attributes must bedecimals.
± Each column has a specific range of values
known as the attribute domain.
± Each row carries information describing oneentity occurrence.
± The order of the rows and columns is immaterialin a DBMS.
8/7/2019 RDBMS SESSION 1
http://slidepdf.com/reader/full/rdbms-session-1 40/40
Difference between DBMS and RDBMS
DBMS RDBMS
It does not need to have data intabular structure nor does it
enforce tabular relationship
between data items.
In RDBMS, tabular structure is amust and table relationships are
enforced by the system. These
relationships enable the user to
apply and manage business rules
with minimal coding.
Small amount of data can be
stored and retrieved.
RDBMS can store and retrieve
large amount of data.
DBMS is less secure than
RDBMS.
RDBMS is more secure than
DBMS.
It is a single user system. It is a multiuser system .
Most DBMSs do not supporting
client/server architecture.
It supports client/server
architecture.
top related