Database Assignment
Database Assignment
c
»
»
Ý
!" ##$ $!
%$##
#%! $ #
$#
##
&
$
#%
#$#
%# #!$%$#'
$ # $
$!
'%
# $ "$##
%
# $
Due to its centralized nature, the database system will overcome the disadvantagesof the medical
centre¶s file-based system as discussed below:
Since the whole data resides in one central database, the various programs in
the application can access data in different data files. Hence data present in
one file need not be duplicated in another. This reduces data redundancy.
However, this does not mean all redundancy can be eliminated. There could
be business or technical reasons for having some amount of redundancy. Any
such redundancy can be carefully controlled.
÷ ~Data Consistency
÷ Data Integration
Since related data is stored in one single database, enforcing data integrity is much
easier. oreover, the functions in the DBS can be used to enforce the integrity rules
with minimum programming in the application programs.
÷ ~Data Sharing
Related data can be shared across programs since the data is stored in a centralized
manner. Even new applications can be developed to operate against the same data.
Y
÷ Enforcement of Standards
The application programmer will not need to build the functions for handling issues
like concurrent access, security, data integrity, etc. The programmer will only
need to implement the application engagement rules of the centre. This brings in application
development ease. Adding additional functional modules is also easier than in
file-based systems.
÷ Better Controls
Better controls can be achieved due to the centralized nature of the system.
÷ Economies of scale
Wasteful overlap of resources and personnel can be avoided by consolidating data and
applications across departments.
÷ Reduced aintenance
aintenance is less and easy, again, due to the centralized nature of the
system.
(
' # $
$''#
#!
1) Equipment failure ± RAID (Redundant Array of Independent Disks - protects against data
loss due to disk failure)
2) Loss of data integrity- someone may alter the data due to which it becomes invalid.
Invalid data may cause ³wrong decisions´. Recovery and backup procedures can be used
to cushion against this problem.
(
'%#' $% #
##%#%%'"
# %$##
Hardware
Software
p
#%$'
¡
± the robustness and stability of the Operating System will be of
material importance to me. Some operating systems don¶t work unless they are rebooted twice or
so a day. These should be avoided. I would also be looking for an Operating System with good
memory management and sharing capabilities.
ú
± I would go for the least number of physical hard drives that can give
me adequate redundancy. If I have one hard-drive and it fails I would be in trouble so I would
opt for RAID (Redundant Array o f Inexpensive Disks).
#%
%'
s ± in the event of the need for dedicated database servers I
would go for client-server databases such as Oracle. In the absence of this need I would go for a
file-server database.
.
± different software handles different database size limits. For
maximum scalability and maximum database sizes I would opt for a client-server database
software such as Oracle or icrosoft SQL Server. In this particular incident however I would go
for Access or icrosoft Visual FoxPro.
!$" ± is a technique for organizing and documenting a database system¶s data
by defining and analyzing the data requirements needed to support the business processes of an
organization.
$!
Example
B
(
$
$ "
1. The relational model is:
correct: the semantics of the relational algebra are sound and complete
predictable: the consistent semantics enable users to easily anticipate the result of a given
query
2. The model executes query languages whose queries can be automatically compiled,
executed, and optimized without resorting to programming.
3. . : making a change in the structure of the tables in the network model requires
programmatic changes to all the database¶s queries. As a result, the network model is
inflexible. The relational model separates the logical from the physical model and this
decoupling (sharp and clear boundary) eliminates these problems.
4. E
: the relational model¶s integrity constraints are very helpful in ensuring that
structural changes do not adversely affect the meaning of the database.
ô
5. : it is straightforward to present different user groups in different views of
the same database.
6. µ
: a full theory of transaction concurrency control exists which depends upon
the theoretical formalisms of the relational model.
$ "
1. Substantial hardware and system software overhead.
2. Poor design and implementation is made easy.
3. ay promote ³islands of information´ problems.
4. ay not fit all business models
'$!
The database models an owner-membership relationship where a member can have many
owners.
Example:
The database is logically represented by an upside down tree. Each parent can have many
children (segment linkage), but each child has only one parent.
Example:
$ "%##$!$
1. Conceptual simplicity: relationship between layers is logically simple; design process is
simple.
2. Database security is enforced uniformly through the system
3. It provides data integrity.
4. It allows for data independence.
5. It is efficient in design as it uses 1: relationships especially when
users require large numbers of transactions.
$ "
1. Complex implementation: physical data storage characteristics and database design is
complicated.
2. Difficult to manage and lack of standards
3. Lacks structural independence
4. Applications programming and (pointer based) use
is complex.
5. Implementation limitations, i.e. especially that it
only handles 1: type of model.
!#$$!
Data is organized using
± Objects
î
± Classes
± Entities
± Attributes
± ethods
( an object diagram for a university department.
é
é
Staff ID Course Code
Name Course Title
Address Course Summary
Salary Grade
Day
Time
Location
Course Code
Session Type
Staff ID
$ "
M Ò
: the ability of the model to distinguish between two different objects that have
the same state. The state of an object can be shared by several objects via object identity.
M
it models a kind of abstraction that enforces a clean separation between the
external interface (behavior) of an object and its internal implementation. Encapsulation
requires that all access (or interaction) with objects be done by invoking the services
provided by their external interface.
M µ
: the ability to define data types whose implementation has a nested structure.
The state of an object could be built from records of primitive types, other objects, or
collections of objects.
M ¡
: the ability to define new data types from previously defined types by
enhancing or changing the structure or behavior of the types. Type inheritance is a
mechanism used to define new types by enhancing already existing behavior.
M .
M \
: The types of the object data model with which the object query language
collaborates must be generic. That is, as a new type is added to the system, it must be
queriable.
$ "
m
M Slow pace of OOD (object-oriented design model) standards development
M Complex navigational data access
M Steep learning curve (method needs to be learned by old designers as it is new)
M High system overhead slows transactions
M Lack of market penetration with the new concept
M Current relational DBS's have many OO characteristics
! $$!
Thisis a collection of databases that can be stored at different computer network sites. Each
database may involve different database management systems and different architectures that
distribute the execution of transactions. The objective of the system (DDBS) is to control the
management of a distributed database (DDB) in such a way that it appears to the user as a
centralized database. The database model therefore seeks to model this.
(
$ "
M The model networks promote decentralization.
M In a company, the model might reflect the organizational structure, which is distributed
into units that may be geographically dispersed.
M The model develops improved overall performance as redundancies can be reduced t1o
the bare minimums necessary
M The model guarantees data independence
M The model makes it easy to add new modules (modular growth).
Disadvantages
M The model is complicated as it involves integration of different level architectures and
seems to require more time, skills and resources.
M Possibly, reduced local performance
M Database design is complex.
M High cost of design
M Integrity controls are more difficult to apply.
M There exists lack of experience by many designers as regards the model.
M The model presents a higher impact of failure
! ( '
' $"! $"$!%
I would model it as follows:
M Analyse current data processing
M Analyse general business functions
M Justify need for new data and database in support of business
M Identify scope of database requirements for proposed system
M Analyse overall requirements for business functions supported by database
M Develop conceptual data model with entities, attributes and relationships.
M Analyse in detail the transactions, forms and processes required by the business
functions.
M Integrate database views into conceptual data model
M Identify data integrity and security requirements
M Define database to DBS (database management system)
M Decide on physical organization of data
M Design database processing programs
M Code and test database processing programs
M Complete database documentation
M Install database and convert data from prior systems
M Analyse database and database applications to ensure that evolving information
requirements are met.
M Tune database for improved performance
M Fix errors in database and database applications and recover database when it is
corrupted.
c
! "#$$%! #
é
éé
é
Ý
)
#
' !#!'$!%#$
! $#! $ !
# %
!'!#$
!# " $
»
"
»
»#
»#$$
!
%#
( "%##%
M It highlights constraints and dependency in the data and hence aid the understanding the
nature of the data
cc
M Normalization controls data redundancy to reduce storage requirement and standard
maintenance
M Normalization provide unique identification for records in a database
M Each stage of normalization process eliminate a particular type of undesirable
dependency
M Normalization permits simple data retrieval in response to reports and queries
M The third normalization form produces well designed database which provides a higher
degree of independency
M Normalization helps define efficient data structures
M Normalized data structures are used for file and database design
M Normalization eliminate unnecessary dependency relationship within a database file
$%
$$! $
%
BRANCH(BranchNo, BranchAddress(Title, Author, Publisher, NoOfCopies))
The above entity BRANCH is in 1NF because there are no multi-valued attributes (i.e. repeating
groups).
BranchNo BranchAddress
BranchNo, Title, Author NoOfCopies
Title, Author Publisher
Therefore the normalized entities are:
cY
'## $$$"%
'"
$ $
BranchNo
Title
Author
NoOfCopies
cp
Ý
#!"%##% $! #"
A Company called ×" decided to computerize its employee data. The company has four
departments (anagement, arketing, Accounting and Purchasing), each headed by a boss. One
of the tables called EPLOYEE is as given below:
Required:
)
Ý
! !
$$#$!
INSERT INTO EPLOYEE (PFNO, E_Name, E_Salary, D_Name, Boss)
VALUES(7001, µAlice¶, 75000, µanagement¶, 5);
!%
»
SELECT COUNT (*) AS ReportToBoss2 FRO EPLOYEE
WHERE Boss = 2;
$%
" $!
$ $$!
%
!
%#$%$!
DELETE FRO EPLOYEE
WHERE E_Name = µAlice¶ AND PFNO = 7001;
cô
%
'
"
%
!
SELECT*FRO EPLOYEE
WHERE E_Salary > 30000;
#
"$ #
UPDATE EPLOYEE
SET E_Salary = E_Salary*1.30
WHERE D_Name = µarketing¶;
ý ý
!!"
"
#
µ!µ
¡$!!%µ
&
&' ()*! +
"
,,
µ-./-µ0\$Ò0123
Ò$& $23
!%4
c