0% found this document useful (0 votes)
45 views14 pages

6testing DB Imp m06

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 14

Occupation: Database Administration Level-3

Module title:- Testing physical Database Implementation


Nominal duration 60hrs
Lo1: Undertake database management system modeling
What is database management system?
Evolution of DBMS
In the early days of computing, disk storage was extremely expensive.  Most application systems ran in batch
mode using data that was stored on magnetic tape. Data had to be read sequentially from flat files.  For
performance reasons, the management of data was tightly integrated with the application system. 
As the cost of disk storage fell, opportunities to store data for real-time access arose.  Specialized DBMS
software emerged during the 1960s for the sole purpose of managing data.  Application systems were then able
to focus on the user interface, screen navigation, data validations etc. and could leave the data management
tasks to the specialized DBMS technology.  The application system simply had to call the DBMS when it
needed to read or store data.

The early DBMS systems required that data be structured if a manner that was conducive to how it would be
stored and/or accessed.  Data was stored in database records that were linked to related data via "pointers". (i.e.
hierarchical and network databases).  Although speed of access was good, flexible access to data was not.  

As the cost of data storage fell, it became feasible to store data in tables.  This eliminated much data redundancy
and provided much more flexible data access.  Most DBMS databases today are relational.

What is DBMS?

 A collection of programs that enables you to store, modify, and extract information from a database. There are
many different types of DBMSs, ranging from small systems that run on personal computers to huge systems that
run on mainframes.
 A   database   management   system   (DBMS)   is   a software package that provides an integrated source of data for
multiple users, while presenting different views of that data to different users. It can be characterized as generalized
software that provides a single flexible facility   for   accommodating   different   data   files   and operations, while
demanding less programming effort than conventional programming languages. It features easy access to the data;
it facilitates the storage and maintenance   of   large   volumes   of   data;   and,   most importantly, it provides the
capability for sharing the data resources among different types of users.
 Database   management   systems   range   from elementary   systems   with   single   record

structures, providing rudimentary report formatting facilities,  to very  elaborate  systems. The  very
elaborate  systems handle   several   files   with   hierarchical   or   relational structures,  perform
functions  in  an  online  mode,  and have   sophisticated   query   and   report   writing capabilities
1.6 Types of Database Management System

1. Hierarchical Model
The hierarchical data model organizes data in a tree structure. There is a hierarchy of parent and child data segments.
This structure implies that a record can have repeating information, generally in the child data segments. Data in a series
of records, which have a set of field values attached to it. It collects all the instances of a specific record together as a
record type. These record types are the equivalent of tables in the relational model, and with the individual records
being the equivalent of rows. To create links between these record types, the hierarchical model uses Parent Child
Relationships. These are a 1:N mapping between record types. This is done by using trees, like set theory used in the
relational model, "borrowed" from maths.

2. Network Model
The popularity of the network data model coincided with the popularity of the hierarchical data model. Some data were
more naturally modeled with more than one parent per child. So, the network model permitted the modeling of many-
to-many relationships in data.

3. Relational Model
(RDBMS - relational database management system) A database based on the relational model developed by E.F. Codd. A
relational database allows the definition of data structures, storage and retrieval operations and integrity constraints. In
such a database the data and relations between them are organised in tables. A table is a collection of records and each
record in a table contains the same fields.

Properties of Relational Tables:

 Values Are Atomic


 Each Row is Unique
 Column Values Are of the Same Kind
 The Sequence of Columns is Insignificant
 The Sequence of Rows is Insignificant
 Each Column Has a Unique Name

4. Object/Relational Model
Object/relational database management systems (ORDBMSs) add new object storage capabilities to the relational
systems at the core of modern information systems. These new facilities integrate management of traditional fielded
data, complex objects such as time-series and geospatial data and diverse binary media such as audio, video, images,
and applets. By encapsulating methods with data structures, an ORDBMS server can execute complex analytical and
data manipulation operations to search and transform multimedia and other complex objects.

5. Object-Oriented Model
Object DBMSs add database functionality to object programming languages. They bring much more than persistent
storage of programming language objects. Object DBMSs extend the semantics of the C++, Smalltalk and Java object
programming languages to provide full-featured database programming capability, while retaining native language
compatibility. A major benefit of this approach is the unification of the application and database development into a
seamless data model and language environment.
In contrast to a relational DBMS where a complex data structure must be flattened out to fit into tables or joined
together from those tables to form the in-memory structure, object DBMSs have no performance overhead to store or
retrieve a web or hierarchy of interrelated objects. This one-to-one mapping of object programming language objects to
database objects has two benefits over other storage approaches: it provides higher performance management of
objects, and it enables better management of the complex interrelationships between objects. This makes object DBMSs
better suited to support applications such as financial portfolio risk analysis systems, telecommunications service
applications, World Wide Web document structures, design and manufacturing systems, and hospital patient record
systems, which have complex relationships between data.

6. Semi structured Model


In semi structured data model, the information that is normally associated with a schema is contained within the data,
which is sometimes called ``self-describing''. In such database there is no clear separation between the data and the
schema, and the degree to which it is structured depends on the application. In some forms of semi structured data
there is no separate schema, in others it exists but only places loose constraints on the data. Semi-structured data is
naturally modeled in terms of graphs which contain labels which give semantics to its underlying structure. Such
databases subsume the modeling power of recent extensions of flat relational databases, to nested databases which
allow the nesting (or encapsulation) of entities, and to object databases which, in addition, allow cyclic references
between objects.
Semi structured data has recently emerged as an important topic of study for a variety of reasons. First, there are data
sources such as the Web, which we would like to treat as databases but which cannot be constrained by a schema.
Second, it may be desirable to have an extremely flexible format for data exchange between disparate databases. Third,
even when dealing with structured data, it may be helpful to view it as semi structured for the purposes of browsing.
Advantage of and disadvantage of DBMS

Advantages of DBMS

Using a DBMS to manage data has many advantages

1. Data independency: Application program should be as independent as possible from details of data
representation and storage.
2. Efficient data access: A DBMS utilizes a variety of sophisticated techniques to store and retrieve data efficiently.
This feature is especially important if the data is stored on external storage devices.
3. Data integrity and security: If data is always accessed through the DBMs, the DBMS can enforce integrity
constraints on the data. Moreover, the DBMS can enforce access controls that govern what data is visible to
different classes of users.
4. Data administration: when several users share the data, centralizing the administration of data can
offer significant improvements.
5. Concurrent access and crash recovery: A DBMS schedules concurrent accesses to the data in such
manner that users can think of the data is being accessed by only one user at a time further, the DBMS
protects users from the effects of system failures.
6. Reduced Application development time
Clearly, the DBMS supports many important unctuous that is common to many applications accessing data stored in
the DBMS

7. Controlling Data Redundancy - In the conventional file processing system, every user group maintains
its own files for handling its data files. This may lead to
 Duplication of same data in different files.
 Wastage of storage space, since duplicated data is stored.
 Errors may be generated due to updating of the same data in different files.
 Time in entering data again and again is wasted.
 Computer Resources are needlessly used.
 It is very difficult to combine information.
8. Elimination of Inconsistency - In the file processing system information is duplicated throughout the
system. So changes made in one file may be necessary be carried over to another file. This may lead to
inconsistent data. So we need to remove this duplication of data in multiple file to eliminate
inconsistency.
9. Better service to the users - A DBMS is often used to provide better services to the users. In
conventional system, availability of information is often poor, since it normally difficult to obtain
information that the existing systems were not designed for. Once several conventional systems are
combined to form one centralized database, the availability of information and its updateness is likely to
improve since the data can now be shared and DBMS makes it easy to respond to anticipated
information requests.
Centralizing the data in the database also means that user can obtain new and combined information
easily that would have been impossible to obtain otherwise. Also use of DBMS should allow users that
don't know programming to interact with the data more easily, unlike file processing system where the
programmer may need to write new programs to meet every new demand.
10. Flexibility of the System is Improved - Since changes are often necessary to the contents of the data
stored in any system, these changes are made more easily in a centralized database than in a
conventional system. Applications programs need not to be changed on changing the data in the
database.
11. Integrity can be improved - Since data of the organization using database approach is centralized and
would be used by a number of users at a time. It is essential to enforce integrity-constraints.
12. DBMS free the programmers from the need to worry about the organization and location of the data i.e.
it shields the users from complex hardware level details.
13. DBMS can organize process and present data elements from the database. This capability enables
decision makers to search and query database contents in order to extract answers that are not available
in regular Reports.
14. Programming is speeded up because programmer can concentrate on logic of the application.
15. It includes special user friendly query languages which are easy to understand by non programming
users of the system. The various common examples of DBMS are Oracle, Access, SQL Server, Sybase,
FoxPro, Dbase etc

Disadvantages of DBMS

 few graphical or statistical capabilities


 proprietary formats may limit archival quality of data
 require expertise and resources to administer
 Database systems are complex, difficult, and time-consuming to design
 Substantial hardware and software start-up costs
 Damage to database affects virtually all applications programs
 Extensive conversion costs in moving form a file-based system to a database system
 Initial training required for all programmers and users

Self check 3
1. List types of DBMS
2. Explain the meaning of DBMS
Entities, Attributes, and Entity Sets

Entity: An entity is an object in the real world that is distinguishable from other objects.

 Often, it is useful to identify a collection of similar entities such a collection is called an entity set.
 An entity is described using a set of attributes. All entities in a given entity set have the same attributes. So,
attributes are the particular properties that describe it.
 For each attribute associated with an entity set, we must identify a domain of possible values.
Eg. The domain associated with the attributes name of employees might be the set of 20 character
strings.

 Key: A key is a minimal set of attributes that uniquely identify an entity in an entity set.
In the ER-model, several types of attributes occur:

1. Simple versus composite


2. Single-valued Vs. Multi-valued
3. Stored Vs. derived
1. composite versus simple (Atomic) Attributes
 Composite attributes can be divided into smaller sub parts, which represent more basic attributes
with independent meanings.
 Simple or atomic attributes are attributes that are not divisible

Address composite
composite

city Zip
Street Address state

Apartment Number
Number street

Fig2. Composite and simple attributes

2. Single-valued versus multi-valued attributes


- most attributes have a single value for a particular entity such attributes are called single valued
- e.g Age
- In some circumstances an attribute can have a set of values for the same entity. Such attributes are
called multi-valued
e.g college Degree.

3. stored versus derived attributes


 In some cases, two or more attribute values are related. for example, the Age and Birth Date
attributes of a person.
Age= current date-Birth Date

TP= unit price + quantity

 The age attribute is hence called derivable where as birthdate attribute is stored.
Null values: In some cases a particular entity may not have an applicable value for an attribute

eg college degree departments

Relationships and Relationship sets

A relationship is an association among two or more entities

E.g The person x works in engineering department

As with entities, we may wish to collect a set of similar relationships into a relationship set. A
relationship set can be thought of as a set of n-tuples

{( e 1,−−−,en1 ) | e1 ∈ E 1 ,−−−,en ∈ En }
Each n-tuple denotes a relationship involving

n entities e1 through en, where entity ei is in entity set


Example:

ssn name
lot

Employees

Fig3. Employees entity set

since

SSN did dname budget


SSn name lot

Employee Department
Works in

Fig4. The works-In relationship set

The above diagram shows the relationship set works-In, in which each relationship indicates a department in
which all employees work.

A relationship can also have descriptive attributes. Descriptive attributes are used to record information about
the relationship rather than about any of the participatory entities. E.g since

 A relationship must be uniquely identified by the participating entities, without reference to the
descriptive attributes.
 In the example, each works-in relationship must be uniquely identified by the combination of SSN
and department did.

Employees SSN name lot


1001 Berhe 01

1005 Kebede 01

1027 Gebre 02

1310 Haile 07

department did dname budget


SSn Since did Unique combinations

51 Sales 1M 1001 1/1/91 51


(1001,51)
1005 3/3/93 51
56 Accounting 3M 1005 2/2/92 56 (1005,51)
1027 3/1/92 60
60 Productive 30M (1005,56)
1310 3/1/92 60
(1027,60)

(1310,60)

 For a given employee-department pair we cannot have more than one associated since value.
 An instance of a relationship set is a set of relationships. It can be thought of as a snapshot of the
relationship set at some instant in time. An instance of the works-in relationship set is shown below:

1/1/91
1001 51
3/3/93
1005
2/2/92
56
1027
3/1/92
1310
60
3/1/92

Total participation Department’s total participation


Works-in
many to many
Employees
Fig 5. An Instance of the Works-In Relation Ship

 As another example of an ER diagram, suppose that each department has offices in several locations
and we want to record the locations at which each employee work. Then, this relationship will be
ternary because we must record an association between an employee, department, and a location.

SSN name dnare budget


lot did

Employee Department
Works in

Address Capacity
Location

Fig 6. ER Diagram

Additional Features of the ER Mode

1. Key Constraints
Let’s consider a relationship called manages because the employees and departments entity sets such that each
department has at most on manager, although a single employee is allowed to manage more than one
department. The restriction that each department has at most one manager is an example of a key constraint,
and it implies that each department appears in at most one manager relationship in any allowable instance of
manager. This restriction is indicated in ER diagram by using an arrow.
since
SSN dname budget
name lot did
Employee
Department
manages

Fig 7. An ER Diagram Showing Key Constraint

An instance of the manages relationship set is shown below.

3/3/93

1001

51
2/292

1005

3/1/92 56

1027
60

1310

Employees manages departments

Partial participation One to many total participation

Fig 8. Instance of the manages relationship

When we compare manages & works- In relationship sets, the instance of works-In violates the key constraint
on manages.

A relationship set like manages is sometimes said to be one to many, to indicate that one employee can be
associated with many departments, whereas each department can be associated with at most one employee as its
manager. In contrast, the works-In relationship set, in which an employee is allowed to work in several
departments and a department is allowed to several employees is said to be many to many.

2. Participation constraint
The key constraint on manages tells us that a department has at most one manager. A natural question to ask is
whether every department has a manager. Let’s say that every department is required to have a manager. This
requirement is an example of a participation constraint, and the participation of the entity set departments in the
relationship set manages is said to be total participation that is not total is said to be partial.

Entities and Entity Sets

 An entity is an object that exists and is distinguishable from other objects. For instance, John Harris
with S.I.N. 890-12-3456 is an entity, as he can be uniquely identified as one particular person in the
universe.
 An entity may be concrete (a person or a book, for example) or abstract (like a holiday or a concept).
 An entity set is a set of entities of the same type (e.g., all persons having an account at a bank).
 Entity sets need not be disjoint. For example, the entity set employee (all employees of a bank) and the
entity set customer (all customers of the bank) may have members in common.
 An entity is represented by a set of attributes.
o E.g. name, S.I.N., street, city for ``customer'' entity.
o The domain of the attribute is the set of permitted values (e.g. the telephone number must be
seven positive integers).
 Formally, an attribute is a function which maps an entity set into a domain.
o Every entity is described by a set of (attribute, data value) pairs.
o There is one pair for each attribute of the entity set.
o E.g. a particular customer entity is described by the set {(name, Harris), (S.I.N., 890-123-456),
(street, North), (city, Georgetown)}.

An analogy can be made with the programming language notion of type definition.
 The concept of an entity set corresponds to the programming language type definition.
 A variable of a given type has a particular value at a point in time.
 Thus, a programming language variable corresponds to an entity in the E-R model.

Figure 2-1 shows two entity sets.


We will be dealing with five entity sets in this section:

 branch, the set of all branches of a particular bank. Each branch is described by the attributes branch-
name, branch-city and assets.
 customer, the set of all people having an account at the bank. Attributes are customer-name, S.I.N.,
street and customer-city.
 employee, with attributes employee-name and phone-number.
 account, the set of all accounts created and maintained in the bank. Attributes are account-number and
balance.
 transaction, the set of all account transactions executed in the bank. Attributes are transaction-number,
date and amount.

Relationships & Relationship Sets


A relationship is an association between several entities.

A relationship set is a set of relationships of the same type.

Formally it is a mathematical relation on (possibly non-distinct) sets.

If are entity sets, then a relationship set R is a subset of

where is a relationship.

For example, consider the two entity sets customer and account. (Fig. 2.1 in the text). We define the
relationship CustAcct to denote the association between customers and their accounts. This is a binary
relationship set (see Figure 2.2 in the text).

Going back to our formal definition, the relationship set CustAcct is a subset of all the possible customer and
account pairings.

This is a binary relationship. Occasionally there are relationships involving more than two entity sets.

The role of an entity is the function it plays in a relationship. For example, the relationship works-for could be
ordered pairs of employee entities. The first employee takes the role of manager, and the second one will take
the role of worker.

A relationship may also have descriptive attributes. For example, date (last date of account access) could be an
attribute of the CustAcct relationship set.

Attributes
It is possible to define a set of entities and the relationships among them in a number of different ways. The
main difference is in how we deal with attributes.

 Consider the entity set employee with attributes employee-name and phone-number.
 We could argue that the phone be treated as an entity itself, with attributes phone-number and location.
 Then we have two entity sets, and the relationship set EmpPhn defining the association between employees and
their phones.
 This new definition allows employees to have several (or zero) phones.
 New definition may more accurately reflect the real world.
 We cannot extend this argument easily to making employee-name an entity.

The question of what constitutes an entity and what constitutes an attribute depends mainly on the structure of the real
world situation being modeled, and the semantics associated with the attribute in question.

You might also like