Académique Documents
Professionnel Documents
Culture Documents
Data Base
A Data Base is shared collection of logical interrelated data.
Eg: A university needs to record data to help in the activates of teaching & learning therefore
three record what kind of students & lectures they have what are the courses & modules they
are running which lecturers are teaching what modules.
One the data is entered in to a database it could be utilization to get complete & accrete
information’s such as list of students who have enrolled for each modules. this can help to
make decision on room utilization .etc..
Advantages of Database
1. Better data sharing
2. Better security & integrity
3. Reduced redundancy
4. The program & data are independent
5. Multiple views of data.
Disadvantages of Database
Database Approaches
Database approach emphasizes the integration & sharing of data. There are 2 designing
approaches.
Requirement Analysis
Process Design
Data Design
Implementation
File processing system a process driven approached was traditional being used with this
approche organization process such as order processins, inventory control, pay roll are
identified & analyzed.
Process and data flows between processed are described using tools such as
DED. Designers work backwards from the required outputs of the system to determine the
requirement unput. They can use flow chart into outputs. Finally they design data file as a
wide product of product of process divan design.
Requirement Analysis
Data design
Process Design
Implentation
It forcuses on entities person, Plese, events or concept about which an organization choose to
record data. This approche ideenti files the attributes of the properties of these entities & the
relation ship among them. It also identities the business rules that speifiese how the entities
are managed or used. After creating the suitable module of the data structure and related
business rules the designer developes the application reqired to manage the data.
Database development
This involves building a “real world” model expressed interms of data requirements. The
initiaset of information & processing reqirements are gathered from the users. The
developments of the large databases conception modeline may consis of view integration
(combining the user views into onces schema) The output from this stage is the entity
relationship digram.
(3)
This involves the building of the real world expressed interms of a data model.
Eg. Hierarchical, Network ,Relational.
This involves determind the concept of the database using the conception model as input &
transforming it into the architectural data model.This is the mapping of the ER model.to the
relational model & caring the process of normalization.
This involves building a model of the real world expressed interms of data structures &
Acces mechanisum available in a choosen Database management system.
This involved in a transformation of a logical data model suitable for a specific software
/Hardware specification. This is usuall expressed in data dominion language & theoutput of
this stage is implementation plan.
Entity
An entity is the thing we modeled & it is something about which we wish to store
information we name the entities with the singular noun. An entity can be 1-Aperson –
Employer, student, customer etc. 2-A place – It could be a state country , region etc.3-An
object – chair,Table, building etc. 4- An Event – sales, Rigistration, Renewal. 5- A concept –
Acount ,Course
The organization. ER models are usually constructed during the analysis phase of the DB
development process. Output of this stage is a coceptval data model expressed in the form of
a detailed ER digram. The ER digram consist of entities relationships & attribules.
(4)
Basic Systems of an ER digram.
Entity Relationship
Attributes
Registration
Attributes.
Student No
Attributes
Name
Add
Tel No
ationship
Association between entities. Can be specified using relationship. There are 3 basic kind of
relationship. 1- 1:1 (one – to – one)
2.- M (one – to – Many) / (1:*)
3 – M:M (Many – to – Many ) / (*:*)
1:1 (5)
1.
Country H Capital
1 1
Lock
2. H Key
1 1
Husband H Wife
3
1:M/ / 1:* *
1 Invoice
B
1. Customer
1 *
2. Mother Child
H
ave
.
1
3 Sales Man
Shop has
M: M /*:*
PE *
. *
Student Regis Sales Man
ter
Cannot allow M:M for introduced “Link Entity” with two 1:M relationship.
(6)
Student Student
OR
1
***
*
Course
Enrolment Student
Country
C
1
*
Language
*
1
Person
(7)
British counsil library
Library items – Book / CD – DVD / Enayclopedia
Reception
Membership Readers
Libraraian
Encyclopedia
Copy
D
A eati
1.*
Librararian
Lending
Collection
(8)
Primary Key
Table Name
1: M Relationships are represented as relational schema by taking the key field of the
table at one end gide as a foreign key to the table at the many end side.
Eg: Customer Customer (CNo Primary key, Name, Billno,goods-------)
Foreign Key
Order Order (Order No,Name---------(No)
1:1 relationship can represented as one table A turnary relationship is respresented as
1 table with the compersit primary key which consist of all & identifiers of the 3
tables.
Manage
Employee **
Employee (EmpId , Name,
Add.DoB ------
If there are M:M relationship they should be avoided by breaking them into 2, 1:M
relationship for that we have to introduced additional entity call link entity. LE is
added which cross references between instances of 1 entity & instances of other
entity. The many ends of the relationship upper at the LE. Thhe PK of the 2 entities
are in corperated into the linkentity.
(9)
There can be two types of entities avatable in ER digram 1- Super type entity
2. Sub type entity
Attributes
These are the charatristics of entities can be used to disscribe entities and relationship
in the ER digram.
An entity can have many attributes but should have an identification key. A key is an
attribute or group of attributes which can identify an entity uniquely. A key attribute
can be underlined in the ER digram.
There are single valued attribute is 1 that can have sigle valued attribute
Relationship partiapation
Praticipation in an entity relationship can either optional or mandertary
Optional relationship
Here the participation is optional if one entity occurrence doesnot require the
corresponding entity occurrence, Entity.
Mandertary relationship
Relationship participation is mandertary (must) if one entity occurrence in a
pertionship indicate that the minimum cardinality is one mandertary entity
(10)
Relationship degree
The relationship degree indicates the no.of associated entities or types with the
relationship.There are 3 of relationship
1- unary (Reairsive)
Binary Relationship
Unary
Deal Company
Customer moni
s
tor
Individual Cons
ult
Turnary
11
1. Note book
pen
write
person
2. Student
Text book
Study
Teacher
(12)
3. Company
Staff
Neeal
Customer
4.
Bank
Individual
Need
Money
(13)
Binary
*
1.
Person Language
Communicat
* Food
2 Individual
eat
3. Country *
District
Have
Company *
4
Staff
Have
5, *
Student Subject
Study
Weak Entity
Weak entity is one that needs e following conditions.
Hierchocl model.
This was e 1st database model interduced in mid 1960’s & was based on e hierarchical model.
Which assumes that all data relationship can be structured as hierarchical.
The hierchieal data model uses a simple approche where e relationship between entities are
always 1:M, This forms a simple one parent record abcord above it & many child record
below it.
* *
Customer Invoice Invoice line
This digram illustrate how can make a hierrchi showing e relationship between customer
invoice & Showing e relationship between customer more invoice line A Cuctomer can own
one or more invoice lines. In hierarchical database model these file would be tide together to
e physical point.
Al Pointer is a physical address which identify where a rewrd can be found on a
disribed.
Disadvantages.
- Large amount of data is stored
- There is only one path to access data item
- Difficult in the real world.
- Difficult to perform ad-hos quries
Network Model
The Network model was created to represent complex data relationship more effectively than
e hierarchical model. In e network model any record main have many immediate parent
records as well as many child records. The network model is able to model greater number of
real world situation. The network model build around e concepts of “Set”.
In a network Data base model a relationship is called set (There are 1:M relationship
between e owner & e member)
Each set is composed of atleaset 2 record type whwre e owner = hierarchical parent record &
e member record = The hierarchical child record. The differents between e night inelude a
than one set. In other words a member can have several owners.
(15)
Supplier
m
1
Ubrary
m Staff
1
m m
Library item
m 1 Member 1 m Fine
1
m
Reterence
Disadvantages
- When compare to hierarchical structure the network strueture is more complicated by
the set concepts
- The hos quries are difficult to execute
- The programmer should know the structure as well as set type which makes of the
networking before processing is done.
Relational Model
Relational model user the table from of data collection, which is similler to hles. Tables
within the relational model are known as relations.
The records in the table are known as “tuples” in a relational model a relational or table
consist of a series of rows the columns. A column is known as field where a row is to tuple
STUDENT Field= Couumns
Primary Reg No St Name St Add Tel
key
00106 Krishi Col-06 2361742
Rg.No
Record/ Tuple/ Row
Stude Paym
Course code Payment Amt Reg No
Forein key
Relations can be related to each other by sharing common entity caracteristies. The common
link between student & payment tables enable us to connect the student to the payment table.
Even though their details are stored in seperrate tables this is done by the use of payment key
– foreign key concept.
This relational model contains 3 relation type normally 1-1:1 2-1:M 3- M:M
1- Primary Key- A Primary key is a attribute that can uniquely inentity given row.
2- Eg.In student table primary key can be taken as “Reg No”
2.- Composit key – Aprimary key can a single attribute or commpersision of several
attributes. Which can be used to uniquely identify a row or tuple. A unique identifier cabn be
made up of mony attributes & that is call a composite primarykey.
Compsit key
Eg: Reg No, Course Code STUDENT
Course code
Reg No
0001 HND
0001 Multi
0001 C++
3- Foreign key – An attribute (or combination of attributes) in one table whose values
match the primary key in another table is called as foreign key. Foreign key is an
attribute whose values match primary key values in the related table.
STUDENT PAYMENT
Reg No RegNo**
Eg.
Person ID Project ID Supervisor ID Time spent
1. Entity Tntegrity
Specially all primary key entries are unique & no part of a primary key may be null. This is
to gurante that each entity will have a unique identity and ensure that foreign key values can
be properly identified .
Eg:
No invoice can have a duplicate number as well as it cannot be null. All invoices uniquely
identified by their invoice number.
A foregn key may have either a null value as long as it is not part of its tables primery key or
an entry that matches a primary key value in a table to Which it is related. This is to make. It
possible for a attributes not to have a corresponding value but it should be impossible to have
invalid entry .
Eg: 1 M
Teacher Student
TEACHER Teach
1 *
1- Employee
Supervision Superviser
Supervisor
2.
Bank Account Have Customer
Bank Account
Saving 0.05
Current 0.15
3-
Movie Star
Movie
Star
Relational Database operators (Relational Algebra) manupilahng tables and its contents using
8 relational operators. 1- Union
2- Intersect
3- Difference
4- Product
5- Select
6- Project
7- Join
8- Divide
Union
This combines all the rows from 2 tables. The tables must have the some attributes to be used
in the union.
Stno
Name Add Tel Stno Name Add Tell
Intersect
Intersct output only the rows apperar in both tables. In this case the tables must be union
compatible to produce a valid result. You cannot use intersect if one of the ottributes is
numeric & the other is character base.
Difference
Select
Select output values for nall rowsfound in table. Select can be used to list either all of the row
values or it can output only. Those row values that match a specified criteria, In other words
select outputs a horizontal substraction of a table.
Project
Project outputs all values for selected fields. In other words project outputs a vertical
substraction of a table.
Item 1
ItemID Name Description Qty
0001 AA Shoe 20
0002 BB Noodle 30
0003 CC Bread 40
Item 1
Item 2
Item ID Name
0001 AA
0002 BB
0003 CC
Divide
Divide requires the use of one single column. Table 1 two column table
A B Divide A/B
IT ode
ITcode Description 0001 Description
0003 AA
0001 AA 0007
0002 BB CC
0008
0003 CC
0004 DD
Eg:2 Divide Code Loc No
Code Loc No A 5
A 5 B
A 7
B 5
B 6
B 3
Q Table-1 Table - 2
Reg No Name Add Tel No Reg Course
0001 AA Col-3 1111 No Name Add Tel No Name
0002 BB Col-4 2222 0005 EF Nuge 5555 HND
0003 CC Col-5 3333 0006 GH Maha 6666 NCC
0004 DD Col-6 4444 0007 HI Kirula 7777 BIT
0008 JK Katta 8888 ICT
0003 CC Col-5 3333 HND
1- Union
3- Product
Reg No Reg No Name Add TelNo Name Add Tel No Course
Name
0001 AA 1111 00005 EF Nuge 5555 HND
0001 AA 1111 00006 GH Maha 6666 NCC
0001 AA 1111 00007 HI Kirula 7777 BIT
0001 AA 1111 00008 JK Kotta 8888 ICT
0001 AA 1111 0003 CC Col-5 3333 HND
0002 BB 2222 0005 EF Nuge 5555 HND
0002 BB 2222 0006 GH Maha 6666 NCC
0002 BB 2222 0007 HI Kirula 7777 BIT
0002 BB 2222 0008 JK Katta 8888 ICT
0002 BB 2222 0003 CC Col-5 3333 HND
0003 CC 3333 0005 EF Nuge 5555 HND
0003 CC 3333 0006 GH Maha 6666 NCC
0003 CC 3333 0007 HI Kirula 7777 BIT
0003 CC 3333 0008 JK Katta 8888 ICT
0003 CC 3333 0003 CE Col-5 3333 HND
0004 DD 4444 0005 EF Nuge 5555 HND
0004 DD 4444 0006 GH Maha 6666 NCC
0004 DD 4444 0007 HI Kirula 7777 BIT
0004 DD 4444 0008 JK Katta 8888 ICT
0004 DD 4444 0003 CC Col-5 3333 HND
4-Difference
Reg No Name Add Tel No
0005 EF Nuge 5555
0006 GH Maha 6666
0007 HI Kirula 7777
0008 JK Katta 8888
Name
EF
GH
HI
JK
6-Select * (All) From Table 2 Where Add ≠ Col-5
Reg No Name
0001 AA
0002 BB
0003 CC
0004 DD
Join
Join allows us to combine information from 2 or more tables. Join has power for relational
Databases alliwing to use of independent tabales to linked by the common attributes.
CUSTOMER AGENT
Code CName CAdd ACode
0001 A Col-3 2002
0002 B Col-4 1001
0003 C Col-5 2002
A Code AArea ATel
0005 D Col-6 3003
1001 Kirula 2222
2002 Moha 3333
3003 Kohu 4444
Product
Per form the select condition where customer Acode = Agent Acod
TABVLE – 1
Q.
SNo SName Course CAdd
1111 AA HND L11
2222 BB BIT L12
3333 CC VOW L11 ACode AAdd ATel
4444 DD Multi L12 L11 AB A
Model L12 BC B
L13 DE C
L15 FG D
Product
Sno Sname Course Lecid Lecid Lecname LecQual
1111 AA HND L11 L11 AB A
1111 AA HND L11 L12 BC B
1111 AA HND L11 L13 DE C
1111 AA HND L11 L15 FG D
2222 BB BIT L12 L11 AB A
2222 BB BIT L12 L12 BC B
2222 BB BIT L12 L13 DE C
2222 BB BIT L12 L15 FG D
3333 CC VOW L11 L11 AB A
3333 CC VOW L11 L12 BC B
3333 CC VOW L11 L13 DE C
3333 CC VOW L11 L15 FG D
4444 DD Multi Mid L12 L11 AB A
4444 DD Multi Mid L12 L12 BC B
4444 DD Multi Mid L12 L13 DE C
4444 DD Multi Mid L12 L15 FG D
Relational Analysis
There are 2 ways of describing relational model. One method uses the tearms relation,
attributes & tuples. The other method describes the model using more familier tearms that is
table, field, record/ row.
The relational model describes the data as a set of relations & table. Each relational table has
a table name with set a attributes & each attribute having a unique name.
The relation attributes are same as table columns or fields. Each relation has set of tuples/
records in a table.
There is a close crospondence between the ER model & Relational model.
ER View
Employee Project
*
Employee Project Assignment Project
EmpNo ProNo
Employee
Empno Name Add Tel
1111 AA Col-3 1234
2222 BB Col-4 1235
3333 CC Col-5 1236
4444 DD Col-6 1237
Project
Normalization
What is Normalization is a formal process for designg which attributes should be grouped
together in a relation. Before proceding with the physical design we need a method to
validate the logical design to this point. Normalization is a tool to validate & improve a
logical design. It needs to satisfy some constrain.
Reason for normalization data structure to avoid data redundancy – If a creting fields occurs
in DB several times errors can are 3 types of anomalies exist
1- Insertion Anomaly
2- Deletion Anomaly
3- Updation Anomaly
Insertion Anomaly
Employee
Empno C-ID CName Dura Price
Empno Name Add -------
E100 Smith Col-1 E100 D-100 DICS 5m 65000
E150 James Col-2 E100 D-1100 IAD 1yr 10900
E300 Ann Col-4 E300 D-25 BSC 7yr 12500
E350 David Kandy E100 M-100 MCSE 5yr 15000
Supose that we need to add new course details to EMP_ course table where the PK is
EMPNo, C-ID. To insert a new row the user must supply the values for both empNo & C_ID.
This is an anomaly since the user should be able toenter the course details without supplying
the EMPNo.
Deletion Anomaly
Suporse that the data for EMPNO E100 is deleted from the table this will result in loosing the
information to the course name,IAD ,DICS,MCSE
To voide these anomalies we can apply normalization process for the data.
Remove repeation
Boyce code
Determinency & Dependency
During normalization logical assouations between data items are identified & represented in
the DB Design without any file maintenance anomalise. Identitifycation of logical
associations between data items is important in normalization & DB design. Such
associations between data items are calle determinency & dependency relationship .
Eg:
If we can difermine a specific valie of data item “V” If we know the data item determinant &
Data item V set to be the dependent.
Functional dependency
Normalization is based on the analysis of functional dependency, A functional dependency is
a relationship between 2 attributes
Eg: - A relation “R” has an attribute A for every value instance of A this is value of a uniquely
determines the value of B for a give.
Candidate key
This is a determinant that can uniquy identified non key attribute are functionally dependent
on part of the primary key.
Eg:- Emp Course (EmpID,Name CName, CDuration)
Course name & Duration depends on parts of the primary key that is empid the other part
will be linked by CID.
Moltivalued dependency
This is a type of dependence of exist where there are atleast 3 attributes in a relation
Eg: A,B,C,Relation
Each value of a there is a well defined value for B & well defined value for C But the set of
values of B indepennent of C
Eg:
Subject Teacher Tex Book
DBD AA Text 1
DBD BB Text 1
Transitive dependency
This is funtionnal dependency between 2 or more “non key” “Attributes in a relation.
Eg: Consider thye following relation
Eg: Consider the following relation
Sales (CNo,Name, Sales person, region)
In the above relation each sales person is asigened to a unique region
We can identify that functional dependence exist in tne sales relation
i- Customer No Name
Sales person
Region
The region is functionally dependent on sales person & sales person is functionally depend
on CNo, AS a result there are update anoma lies in the sales relation.
Eg: We can,t add new sales person to a new region without a customer.
If we delete a customer we,ll loose the sales person information aswell.
3- If a salesperson is transferred to a new region then the several rows must be changed.
2- 3NF- Eleminate columns not depend on key- If attribute do not contribute to the
description of key remove that to a separate table.
3- BCNF- This is Boyce codd Normal dependency between candidate key attribute
sdperte them to different table.
Moving the known DB into a separate table helps a lot. Sepatating the repeating groups of
DBS from the member information results in INF. The member ID in the Database table
matches The PK in the 2 tables with a join operation. Now we can answer the question by
looking in the database table for “DB2” & getting the list of member.
DataBase Table
Member list
Member DID MID Database
1. Jojn SmithAccess DB2 table 1 1 Access
FoxPro MID Name 2 1 DB2
2. Dave jones dBase,Clipper 1. 3 1 Foxpro
3. Mike Beach Johnsmith 4 2 dBase
4. Jerry Miller DB2, Oracle 2. David 5 2 clipper
5. Benstuary Oracle, Sybase Jones 6 4 DB2
6. Fred Flint Informix 3Mile 7 4 Oracle
7. Joe Blow Beach 8 5 Oracle
8. Greg brown Access , Missq 4.Jerry 9 5 Sybase
Server Miller 10 6 Infomix
9. Doughope 5. Benstuart 11 8 Access
6. Fred 12 8 Mssqlserver
Flint
7. Joe Blow
8. Gre
Brows
9.
Dougltope
Or suppose the last member listing a particular database leaves the group. This records will
be removed from the system, & the data base will not be stored anywhere . This is a delete
anomaly. To avoid these proplems, we need 2NF.
To Achieve this ,separate the attributes deperching on both parts of the key from those
depending only on the Database ID. This results in 2 tables: “ database” Which gives the
name for each database ID , and “Member database” which list the databases for each
member.
The member table satisfies INF – It contains no repeating groups. It satisfies NF – since it
does’t have a multivalued key. But the key is member ID,& the company name & location
describe only a company, not a member. To achieve 3 NF, They must be moved in to a
separate table. Since they describe a company, company code becomes the key for the new
“company” table.
The motivation for this is the same for 1NE : we want to avoid update & the IBM were
currently stored no members from the previous design, there would be no record to its
existence, even though 20 past members were from IBM:
Member Table
BCNF covers very specific situations where 3 NF misses inter- dependencies between non-
key (but candidate key) attributes. Typically, any relation that is in 3 NF is also in BCNF if
(a) there are multiple candidate keys, (b) the keys are composed of multiple attributes & (c)
there are common attributes between the keys.
Eg:
Class Enrolment
Classcode Class Discription Student No Name
503 Mgt Info 0001 AA
0003 BB
0005 CC
540 Maths 0002 DD
0004 EE
Data cannot be stored or processed in a database when it this from. What we musthave is one
record containing all the data for each student.
INF
Enrolled in a class, there can be no “gaps” in the data when stored in a file
The above table is in the INF no repeating data & no gaps.
To take the table to the 2NF we would have to remove partial dependency.
Class Information Student Info
Class code Class
Discription
503 Mgt Info
540 Maths Class code Student No Name
503 0001 AA
503 0003 BB
503 0005 CC
540 0002 CC
540 0004 EE
Thhe first DBMS appeared during the 1960’s at a time in human history where projects of
momentous scale were being contemplated planned engineeed never before had such large
data problems on the flow where identified & solutions were researched & develop ofen in
real time
The BBMS became necessare because the data was for more volatile than had earlier been
planed & because there was still major limiting factors in the cost associated with data
storage media. Data grew as a detailed transations by transation levels In the 1980’s all the
major vendors of hardware system large enough to support the e volving need of evolving
computerized . record keeping systems of large oranizations bundle some from of DBMS
with their system solution.
The 1st DBMS species were thus very much vendor specific. IBM as usual let the field but
there were a growing no of competes and cloneds whose DB solution offered varing entry
points in to the bandwagon of computerized record keeping system.
Through this time the specifc nature of the problems being resolved & were around from the
perspective of IT management were evolving with the teahnology & the no of main frame &
mini computer hardware vendors in creased & the no of pheriperal types & their vendors also
increased. The bundeling of DB operational sevices such as the ability to perform &
Schedule data backup became routine. The IT operational environment at this
time was categorized with a collection of system house keeping task with major emhersis on
organization produetion DB backup. File recoranization & reindex ation of data were also
standard but mainly manual system house keeping system task. Other tasks incude storage
media arehival management of document & records or business perticilarly those relste to
finance record keeping.
MedPix medical image database uses helthy dos of foss MedPix is a sprawling online
medicimages DB & diagnostic tool that’s used around The wirld by radiologist, nurses,
physicians & medical students & the whole system is powered by linux & open source
software.
MedPix is hosted by the US federal government’s helth sciences university, the uniformed
services university in Bethesda, Maryland. It ‘ s the brainchild of JamesG. Smirniotopoulos,
M.D., a USU professor of Radiology, Neurology & Biomedical informatics & clinical
sciences chair of it’s Department of Radiology & Radiological sciences.
This refers to the ability of introduang changes to the physical sohema without any influence
to the logical schema
Eg: Chaging the storage structure of data without any influence to the wonceptial Schema.
Toolkit
Interface
Kernel.
The DBMS kernel is the central ergine which handles the rain data management functions.
Most DBMS are installed on thetop of some operating systems. Therefore DBMS needs to
interact with operating systems to implement & access the data & system calalogece which
are usually stored on harddisk. Therefore they interact with some of the operting system
elements such as i.- file manager which translate between the data structures manipulated by
the DBMS & the files on the harddisk.
ii. acces mechanism – the file manager doesnal manage the physical input & output of data
directly . It interact with appropriate access mechnisum established for different physical
structures.
System buffer – The reading & writing data is normaly stored in the system buffer of the
operating system.
Functions of DBMS.
- the DBMS must be able to create, retrieve, update, delete the data from the data base
(CRUD Function)
- Data Communication
- Conarrency cCntrol
- Query optimization
- Managing transaction
- Scheduline transaction
- Data Dictionary
- DDL Compilers
DDL Compiler
Data dictioraiyment
Query
Runtime Processor
Pre- compiler
Application programs
Precompiler
DML Compiler
Data abstraction
Data abstraction is the process by which a data base attempts to represent properties of
objects in the real world. A database records. The relevant details required to support some
organizational activities & it does not record all the details. The database is an abstraction of
the real world. The abstraction level varies according to the different commercial databases.
Data Security
Data security is the process of protecting the data from external thrects. Data is key resource
for organization. Loss of data , Privacy , integrity, availability etc are issues that cost an
organization in financial terms.
Data Interation
A data base should be a collection of data which at last has no redundant data. The aim is to
hare 1 database storing 1 logical item of data in one place which can be accessed by a range
of information systems.
Eg: Replacing several departmental data base in one company with one data base system that
can be nade accessible to several departments.
Physical database design must be performed carefully since the decisions made during this
stage have major impact on data accessibility , response time , security , user friendliness ,
ect.
Physical database design doses not include implementing database but it produice a technical
specification that programmers & others involved in information system construction
Logical database structure that were developed during logical design. This structure may be
expressed in itierarachical, Network, relational object oriented & definition for each attribute.
User processing requirements that were identified during requirement definition including
sign , when data is used & where response time , time , data ,security , backup & recovery ,
integrity & retention of data.
Integrity Analysis
Tntegrity defines the business rules or constraints that should apply on the data. There are 4
basic types of integrity rules.
Entity Integrity
This define that each and every entity should have a unique identifier a primary key and it
cannot be null.
Referential Tntegrity
This refers to the rules concerining the relationship between the 2 entity types (1e) by
defining foregn key relational data model.
Domain integrity
This refers to the eonstraction valid values for attributes. We can achieve the domain integrity
for an attribute by specifying the following.
- The type of the attribute
- The length
- Format range
- Allowed values
- Null support or Not
- Check constraints
Triggerring Operations
All the other business rules that protect the validity of an attribute value defined as a tribber
A trigger is a program / proceduire which is aulmatically executed due to an event. An event
can be either Insevetion , deletion / updation.
User Rule: check with drawal amount <Balance Available – 100
Event : Update
Ntity : Customer
Condition : W – Amt <B – Avl – 100
Action : display blance Available to withdraw.
The out put of the physical database design is the implementation plain for the physical
database. It’ll consists of tbhe following elements
- Data structures given in DDL
- Indexes declared on the data structures
- Clustering data
- A set of integrity constraints
- Distribution strategy of the data base
- A set of users
- A Plan for data seairity
Implementation
For database implantation, we use output of physical design to construct the database system
using the mechanisms or features of the selected DBMS. It includes coding & testing
database processing programs completing data base documentation & training materials
installing database , converting data of the implementation we accept a functioning system
that meet the user information requirements. After that the system’ll be put into production
use.
Clustering data
Setn up integrity constant expressed in some data definition language and set of a additional
interity constraints expressed in some data interity language
The designeres must select the file organization tha provides areasonable balancing among
the criteria withing the resource available
Mechanisms available for storing data in a relational system are
Sequeritial files
Hash files
Clustering files
Indexed sequential files.
Adding Index
Index is a table or other data structure that is used to determine the location of the row in a
table that satisfies the condition. Indeex may be defined on both primary key value or non
key attribute value.(Secondary Index)
Indexing improves the access performance but if reduces the update performance because
every time we add a record to a table, each index on that table has to be update, we always
index on primary key & foreign key but sometimes we index on other nonkey attributes of a
table when they are extremely important in the running of some reports.
De – Normarisation
The main problem with fully normalized database is it usually made up of many tables. To
perform queries , such tables have to be reconstructed using join operations. There fore some
database developers occasionally choose to implement a relational database that purposely
violation the principles of normalization. Their goal is to reduce the no.of physical database
tables that must be accessed to retrieve the desired data by needd. But denormalization leade
& it increases the change of errors and inconsistercies.
2 Entities with a 1-1 relationship. If one of the entity’s is an optional participant. If the
matching entity exist most of the time, then it may be advisable to combine the 2 entities in
to one table.
Many – many relationshop with a non key attribute – rather than combining 3 tabless to
extract the data from the 2 entities in a relationship , if may be advisable to combine the
columns from 1 of the entities in to the tables representing the M-M relationship which
avoids 1 joins in many queries.
Reference Data – If exists in an entity on the 1 side of 1 – M relationship & this entity
participates in no other data relationship , then wer can consider of mering these two entities.
Integrity constraints
There are 3 main ways of implementing constraints.
Inherently – We should at leaset be able to specify entity , referentoral & domain integrity.
Procedural – Constraints occus outside the data model. Most existing data model. Most
existing application programs that interface with database implements the constraints
procedurally.
Transaction management with SQL Amaerican national standard Institude (ANSI) has
defined standards that Govern SQL DB tranactions. The transaction support is provide by the
SQL statement commit & roll back.
Commit
A commit statement is reached in which case all changes are permanently recored with the
DB> The commit statement automatically ends the SQL statement.
Roll back
A roll back statement is reached in which case all the changes are dborted & DB is rolled
back to its previous constant state
Trasaction Lock
The DBMS uses a transaction lock to keep track of all transaction to update the DB.
Information stored in this lock’ll be used by the DBMS for recovery requirements though the
roll back statements. 1- A transaction lock stores a record for beginning of transaction
TRA TRA PRE TRA NEXT OPERA TABLES POW ATTR BE FOR AFTER
ID NO TRA TION ID IBUTES Value VALUE
Concurrency Control
The condition of the simultaneous execution of transaction in multiuser DB system is known
as concurrency control. The objective of concurrency control is to ensure the serializability of
transaction in a multiuser DB environment conairrency control is important because the
simultanius execution of trasaction over shared DB can create several integrity & consistency
problems.
Last update
Most common problem that is encounted where multiple users attempt to update DB without
proper concurrency control.
Transation A Transaction B
Check balance (10,000) 10.00
10.05 Check balance (10,000)
Take (2000) 10,10
10,20 Take (7000)
Check balance (8000) 10,30
10,40
The effect of transation is lost due to interference during the transation.
TransationA Transation B
(Check balance (500) 10,00
10.05 transafer 200
Take (1000) 10.10
10,15
Check balance (200) 10,20
Transaction A depends on an uncommitted transaction at 10,05 there fore the end result
transaction A is incorrect because an uncommitted value may be changed due to some
problem in the other transactions.
Trasaction A Transation B
Sam = 0 10,30
Open A C1
(Sum = sum +500
Open AC 2 10,30
(Sum = Sum +100) 10,36 transfer 50 from
AC2 to AC 3
Open AC 3
(Sum = Sum + 200)
50 100 250
Trasaction A should end up with an answer as 300 but the produced answer is 35. this is due
to transaction A has considered an inconsistent situation of the DB. There fore the transaction
has performed an inconsistent analyst.
Types of locks
Shared lock (slock/ Read Lock)
A transaction should place a shared lock on record who it’ll only read that record.
Shared lock allows other transactions to read a record
plaung an slock a record prevents another user from plaung an exolusn lock (updating, write)
on the record.
A S B
Data
Read
Data lock
When 2 or more transaction have locked a common resource & each waits for other to unlock
that resource.
Database security
DB security refer to a process of protecting a ab against accidental or international losses or
misuse. A database administrator is responsible for the security of the db. The follwing are
the different types of threats available for the db.
1- possibilities of the it & frauds – the data related to an organization may be illegally
extracted without any permission by a hacker.
2- Possibility of loss of confidentiality an unauthorises person or a hacker try to access
the corporate date available on the db.
3- Loss of Privaoy – An organization keeps data related to individual persons & viewing
The personal data by others,ll lead to loss of privay.
4- Loss of Integrity – The integrity may be lost due to not implementing the interity
rules properly due to hardware or software problems.
5- Loss of availability – The availability of the database may be lost due to different
reasons such as matural disasters floads, fire, bomb attack, virus attack.
The DBA is responsible for database security they secuirity measures on database can be
defined in 2 different ways
Computer based measurements
Non computer based.
Database Administration
It is a technical function that is responsible for physical DB design & for decurity
enforcement, DB performance, backup & recovery In a large database system, DBA
functions is carried out bythe DB administration or DBA team
The DBA have the following core responsibilities.
Administration of the DB
The main activities of DBA in administrating the database the are physical design of the
implementation.
- Access control 1:- This is dealine with or ceting users, assigning passwords, gran
giving access to DBMS facilities
- Impact Assessment
- Privancy, security, Integrity control
- Education & training.