Você está na página 1de 16

‘

‘
‘
‘
‘
‘‘‘‘‘‘‘‘  ‘‘
‘
‘

‘ ‘
‘ ‘
‘ ‘ ‘
‘
 
‘ 

 ‘‘ 
‘  
‘‘

‘‘  ‘ 
 ‘  
‘
 ‘
‘
‘
‘
‘
‘

‘ ‘  ‘
‘
‘
‘
‘
‘
‘‘
‘
‘
‘
‘
‘
‘
‘

c
 ‘ 
‘ 
‘  ‘
»  ‘‘
  ‘ ‘  ‘   ‘

 
‘

‘‘  ‘»
‘  ‘

 
‘


 ‘‘ ‘ ‘  ‘‘


Instructions
Attempt all questions. You may divide yourselves into groups of fives.
Work that is downloaded and not referenced will not be accepted.

Ý ‘‘
‘
 ‘ ‘!‘" ‘‘##‘‘$  ‘‘$!‘
 ‘%‘‘ $#‘#‘‘
#‘%‘!‘ ‘$‘   ‘‘‘  ‘‘#‘‘‘  ‘‘
$# ‘‘##  ‘&‘  ‘‘$  ‘‘#% ‘‘#‘$‘‘# 
‘  ‘ ‘
%‘‘‘‘# #‘‘!$‘%‘$#‘'
‘
‘ $‘ ‘‘‘# $‘
$!‘
 ‘‘
‘ '‘%‘‘
# ‘‘$ "‘‘ $#‘#‘ 
‘‘%‘
‘ ‘‘‘# $‘

 ‘

Due to its centralized nature, the database system will overcome the disadvantagesof the medical
centre¶s file-based system as discussed below:

÷‘ Šinimal Data Redundancy

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

Reduced data redundancy leads to better data consistency.

÷‘ Data Integration

Since related data is stored in one single database, enforcing data integrity is much
easier. Šoreover, the functions in the DBŠS 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

Enforcing standards in the organization and structure of data files is required


and also easy in a Database System, since it is one single set of programs
which is always interacting with the data files.

÷‘ ~Application Development Ease

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:

‘ BBIT 423 BBIT 323 BBIT 424


‘
‘
‘
‘ P. Omolo A. Arunga J. Koinange
‘
‘
‘
‘
D. Wabili P. Nyong¶o Š. diddy R. Obara
‘
‘
An example of a network model although not necessarily a database model is the widely known
OSI Network Šodel.
‘
$ "‘
Provides conceptual simplicity, just like HDŠ (Hypertext Design Šodel)
± Handles more relationship types (but all 1:Š relationship)
± Data access flexibility
± Promotes database integrity
± Data independence
± Conformance to standards
‘
$ "‘
M‘ System complexity
M‘ Lack of structural independence
‘
##‘$!‘


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.

  
 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 DBŠS'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 (DDBŠS) 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 improves sharing and local autonomy.


M‘ The model improves availability.
M‘ The model improves robustness such that a failure does not make the entire system
inoperable
M‘ The model allows for data replication
M‘ Data are local to the site of ³greatest demand´


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 DBŠS (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
!‘ ‘  ‘‘"#‘$‘ $‘%‘‘! ‘ #


   
  
‘ 
 
‘      
‘ 
    

 
 
‘
é
‘
‘
‘
‘
‘
‘ éé
‘  
‘  
‘ é
  
‘  
‘     
‘ 
‘ 
‘
‘
‘

PATIENT (Name, PatientId, AdmissionDate, DischargeDate,Ward)

EŠPLOYEE (Name, EmployeeNo, DateEmployed, Profession, Address, PhoneNo, Salary)

DIAGNOSIS (RefNo, PatientId, Symptoms, Rationale, Problem, Intervention, Doctor, Nurse)

‘
‘
Ý
 ‘)‘
‘
‘#‘ 
‘'‘ ‘!#‘!‘'‘‘ ‘‘$!‘%‘#$‘
! ‘ ‘‘ $‘‘#‘!‘‘‘  ‘‘$‘ ‘! ‘ 
‘# ‘%‘‘
‘  ‘!‘'‘!‘#$‘‘
‘!# ‘ "‘‘  $‘
‘
» ‘‘" ‘‘
‘ ‘
» »# ‘»#$$ ‘  ‘ ! ‘%# ‘
‘
‘‘ ( ‘‘"%##‘%‘ ‘ ‘ ‘ ‘ ‘

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).

The entity BRANCH is however not in 2NF.


Normalization is as follows:

BranchNo BranchAddress
BranchNo, Title, Author NoOfCopies
Title, Author Publisher
Therefore the normalized entities are:

BRANCH (BranchNo, BranchAddress)

COPY (BranchNo, Title, Author, NoOfCopies)

PUBLISHED_BY (Title, Author, Publisher)

‘
‘
‘
‘
‘

cY
‘'‘‘##  ‘$‘ $‘$" ‘% ‘
 ‘ ‘‘ ‘'"‘
‘‘‘‘‘‘‘‘‘$‘ ‘  $

   é 


BranchNo Title
BranchAddress Author
Publisher


BranchNo
Title
Author
NoOfCopies

cp
Ý ‘‘
#!‘‘"%##‘%‘ ‘‘$!‘ #"‘ ‘

÷‘ Queries allow the user to extract relevant information from a database.


÷‘ Queries also allow the user to join multiple tables.
÷‘ Queries are often used as the basis for reports in Access.
÷‘ Query tables increase the scalability of the overall system.
÷‘ Query tables help to avoid redundant scanning, aggregating and joining.
÷‘ A materialized query table on a remote table can be perceived as a cache for that table,
which in essence enhances system availability.

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 EŠPLOYEE is as given below:

E_Name E_Salary D_Name Boss


PFNO
7001 Alice 75,000 Šanagement 5
7002 Kerina 45,000 Šarketing 1
7003 Andrew 25,000 Šarketing 2
7004 Clare 22,000 Accounting 2
7005 Todd 38,000 Accounting 1
7006 Kariuki 22,000 Šarketing 5
7007 Robert 43,000 Purchasing 1
7008 Sarah 56,000 Purchasing 7
7009 Sophie 35,000 Personnel 1

Required:
)‘
Ý‘ ‘‘
‘
 ‘ ‘‘! ‘!‘

CREATE TABLE EŠPLOYEE


(PFNO SŠALLINT,
E_Name VARCHAR(40),
E_Salary DECIŠAL(5,2),
D_Name VARCHAR(20),
Boss INTEGER,
PRIŠARY KEY (PFNO));

 ‘ $$‘‘#$‘‘‘!‘
‘
INSERT INTO EŠPLOYEE (PFNO, E_Name, E_Salary, D_Name, Boss)
VALUES(7001, µAlice¶, 75000, µŠanagement¶, 5);

INSERT INTO EŠPLOYEE


cB
VALUES(7002, µKerina¶, 45000, µŠarketing¶, 1);

INSERT INTO EŠPLOYEE


VALUES(7003, µAndrew¶, 25000, µŠarketing¶, 2);

INSERT INTO EŠPLOYEE


VALUES(7004, µClare¶, 22000, µAccounting¶, 2);

INSERT INTO EŠPLOYEE


VALUES(7005, µTodd¶, 38000, µAccounting¶, 1);

INSERT INTO EŠPLOYEE


VALUES(7006, µKariuki¶, 22000, µŠarketing¶, 5);

INSERT INTO EŠPLOYEE


VALUES(7007, µRobert¶, 43000, µPurchasing¶, 1);

INSERT INTO EŠPLOYEE


VALUES(7008, µSarah¶, 56000, µPurchasing¶, 7);

INSERT INTO EŠPLOYEE


VALUES(7009, µSophie¶, 35000, µPersonnel¶, 1);
‘ ‘
 ‘
'‘‘ "‘
‘%‘ 
‘

SELECT AVG(E_Salary ) As AverageSalary


FROŠ EŠPLOYEE;

 ‘  ‘‘ !‘%‘ 
‘‘ ‘‘»‘‘
‘
SELECT COUNT (*) AS ReportToBoss2 FROŠ EŠPLOYEE
WHERE Boss = 2;

‘  ‘‘$‘%‘ 
‘" $‘!
‘$  ‘$‘$‘!
‘ ‘%‘
 !‘

SELECT E PFNO, E_Name, E_Salary, D_Name, Boss


FROŠ EŠPLOYEE
ORDER BY PFNO
GROUP BY D_Name;

 ‘ ‘‘%‘#$‘% ‘‘$!‘
‘
DELETE FROŠ EŠPLOYEE
WHERE E_Name = µAlice¶ AND PFNO = 7001;


 ‘  ‘‘‘%‘‘ 
‘'‘
‘"‘‘ ‘% ‘‘ 
‘
!‘

SELECT*FROŠ EŠPLOYEE
WHERE E_Salary > 30000;

 ‘  ‘#‘ 
‘‘‘ "‘$  ‘‘‘ #‘
‘‘

UPDATE EŠPLOYEE
SET E_Salary = E_Salary*1.30
WHERE D_Name = µŠarketing¶;

ý  ý  ‘


   


 
  
    
      

  !!" 
 "  #  
 µ!µ 
 
  ¡$!!%µ
Š 
   &
& ' ()*! + 
"   , ,   
  µ-./-µ 0 \$Ò0123
Ò$& $23  
 
     !%4 

c

Você também pode gostar