Unit 1 DBMS
Unit 1 DBMS
1.1. INTRODUCTION
Data
Data is a raw material. It can be any character, word, number, date etc.
Example: 5, 27-11-2018, Nagercoil, Sherill
Database
Database is a shared collection of logically related data. For example, consider
employee database consists of following columns- eno, ename and salary.
1.1
1.2 Database Design and
1. Data Redundancy:
Data redundancy and inconsistency. Since different programmers create the files and
application programs over a long period, the same information may be duplicated in different
files. This leads to data redundancy.
Example: A student is having record in college office and in computer department. Then, his
telephone number, address will be same in both the departments. This redundancy leads to
higher storage and access cost.
In addition, it may lead to data inconsistency, that is, the various copies of the same
data may no longer agree.
Example: A changed student address may be reflected in the computer department records
but not in the college office.
2. Difficulty in Accessing Data: Accessing data is not convenient and efficient in file
conventional processing system. More responsive data-retrieval systems are required for
general use.
Example: one of the bank officers needs to find out the names of all customers who live
within a particular postal- code area. If there is no application program for this means, the
officer has 2 alternatives: 1. Preparing the list manually from the list of all customers. 2. Ask
system programmer to write the necessary application programs.
3. Data isolation. Because data are scattered in various files, and files may be in
different formats, writing new application programs to retrieve the appropriate data is
difficult.
4. Integrity Problems: The data values stored in the database must satisfy certain types
of consistency constraints.
5. Example: Suppose the university maintains an account for each department, and records the
balance amount in each ac-count. Suppose also that the university requires that the account balance of
a department may never fall below zero. However, when new constraints are added, it is difficult to
change the programs to enforce them.
6. Atomicity Problems: Any operation on database must be atomic, (i.e.) it must happen in
its entirely or not at all.
Example: If you are buying a ticket from railway and you are in the process of money
transaction. Suddenly, your internet got disconnected then you may or may not have paid for
the ticket.
If you have paid, then your ticket will be booked and if not then you will not be charged
anything. That is called consistent state, means you have paid or not.
Example: Consider an operation to debit (withdrawal) an account. The program reads the old
Conceptual Data 1.3
balance, calculates the new balance, and writes new balance back to database. Suppose an
account has a balance of Rs. 5000. Now, a concurrent withdrawal of Rs. 1000 and Rs. 2000
may leave the balance Rs. 4000 or Rs. 3000 depending upon their completion time rather
than the correct value of Rs. 2000.
8. Security Problems: Database should be accessible to users in limited way. Not every
user of the database system should be able to access all the data.
Example: In a university, payroll personnel need to see only that part of the database that has
financial information. They do not need access to information about academic records. To
overcome these difficulties, the database management system (DBMS) was developed.
• An early proposal for a standard terminology and general architecture for database
systems was produced in 1971 by the DBTG (Database Task Group) appointed by the
Conference on Data Systems and Languages (CODASYL, 1971).
• The DBTG recognized the need for a two-level approach with a system view called
schema and user views called subschemas.
• The American National Standards Institute (ANSI), Standards Planning and
Requirements Committee (SPARC), ANSI/X3/SPARC, produced a similar terminology and
architecture in 1975 (ANSI, 1975).
• For our purpose the fundamental point of these and later reports is the identification
of three levels of abstraction, i.e., three distinct levels at which data items can be described.
• These levels form a Three Level Architecture comprising an External, a Conceptual
and an Internal level as shown in the figure on the next page.
• The way users perceive the data is called the external level. The way the DBMS and
OS perceive the data is the internal level, where the data is actually stored using the
appropriate data structures. The conceptual level provides both the mapping and the desired
independence between external and internal levels.
The objective of three level architecture is to separate each user’s view of the database from
the way the database is physically represented.
1. Database Design and
Database Schema
• The overall description of database is called Database Schema.
• There are three different types of schema in the database and these are defined
according to the levels of abstraction of the three level architecture.
• At the highest level we have multiple external schemas (also called subschemas) that
correspond to different views of data.
• At the conceptual level we have the conceptual schema, which describes all the
entities, attributes and relationships together with integrity constraints.
• At the lowest level of abstraction we have the internal schema which is complete
description of the internal model, containing the definition of the stored records, the methods
of representation, the data fields, and the indexing and hashing techniques used, if any. There
is only one conceptual schema and one internal schema per database.
Mapping
• The DBMS is responsible for mapping between the above three types of schemas. Not
only this the DBMS must check schemas for consistency.
• The conceptual schema is related to the internal schema through a conceptual/
internal mapping. This mapping enables the DBMS to find the actual record or combination
of records in the physical storage that constitute a logical record in the conceptual schema
together with any constraints to be enforced on the operations for that logical record.
• It also allows any differences in entity names, attribute names, attribute order, data
types… to be resolved.
Conceptual Data 1.7
• Finally, each external schema is related to the conceptual schema by the external/
conceptual mapping. This enables the DBMS to map names in the user’s view on to the
relevant part of the conceptual schema.
• The Schema is specified during the design process and is not expected to change
frequently. However, the actual data in the database may change frequently.
Instance:
• The data in a database at any particular point in time is called a database instance.
Thus many database instances can correspond to the same database schema. The schema is
sometimes called the intension of database, while an instance is called extension (or state) of
the database.
a) Logical Data Independence refers to the immunity of the external schemas to changes in
the conceptual schema.
1. Database Design and
• Changes to the Internal Schema, such as using different file organizations, using
different storage devices, modifying indexes or hashing algorithms should be possible
without having to change the conceptual schema or external schemas. The conceptual/
internal mapping must be able to absorb them.
b) Physical Data Independence refers to the immunity of the conceptual schema to changes
in the internal schema.
• Following figure illustrates where each type of data independence occurs in relation
to the three – schema architecture.
• The System Catalog integrates the meta data that is data that describe objects in the
database and makes it easier for those objects to be accessed or manipulated.
• The meta data contains definitions of records, data items and other objects that are of
interest to the user or are required by the DBMS.
• The term data dictionary and data directory are also used to describe the system
catalog. At a theoretical level we could identify different DDLs for each schema in the three
– schema architecture, namely a DDL for external schemas, a DDL for conceptual schema,
and a DDL for the internal schema.
• However, in practice there is one comprehensive DDL that allows specification of at
least the external and conceptual schemas.
• Provides a set of operations to support the basic data manipulation operations on the
data
• Data manipulation operations usually include the
following: Insertion of the new data in database.
Modification of data stored in database.
Retrieval (Query) of data contained in the database.
Deletion of data from the database.
• The part of DML that involves data retrieval is called a query language.
• DMLs are distinguished by their underlying retrieval constructs.
• We can identify two types of DML – procedural (Low Level DML) and non –
procedural (High Level DML).
• Typically, procedural languages treat records individually, while non – procedural
languages operate on sets of records.
• With a procedural DML the user or more precisely the programmer specifies what
data is needed and how to obtain it.
• This type of DML typically retrieves individual records or objects from the database
and processes each separately.
• They are also called record-at-a-time DMLs because of their nature of processing a
record at a time.
• Network and Hierarchical DMLs are normally procedural
i) Form Generators
• A forms generator is an interactive facility for rapidly creating data inputs and display
layouts for screen forms.
• The forms generator allows the user to define what the screen is to look like, what
information is to be displayed, and where on the screen it is to be displayed.
• It may also allow the definition of colors for screen elements and other characteristics,
such as bold, underline and blinking etc.
• A very simple form is shown below
Conceptual Data 1.1
Language Oriented:
• In this case we enter a command in a sublanguage to define what data is to be
included in the report and how the report is to be laid out. The best example of this method is
the REPORT FORM command of FoxPro.
Visually Oriented
• In this case we use a facility similar to a forms generator to define the same information.
• The process of building a report using MS Access from Employee Table and how
results look like after report execution is depicted in the next two figures:
1. Database Design and
• A graphics generator is a facility to retrieve data from the database and display the
data as a graph showing trends and relationships in the data (OLAP: Online Analytical
Processing).
• Typically, it allows the user to create bar charts, pie charts, scatter charts etc. from the
data stored in the database.
iv) Application Generators
• An application generator is a facility for producing a program that interfaces with the
database. The use of an application generator can reduce the time it takes to design an entire
software application.
• Application generators typically consist of pre-written modules that comprise
fundamental functions that most database oriented programs use.
• An example of an application generator is VB data control object.
• We have already discussed that following are the components of a database system or
database environment:
1. Hardware
2. Software (DBMS)
3. Data
4. Procedures
5. People
• Here we will examine in detail the fifth component of the database environment i.e.
people.
• For small databases e.g. the list of students discussed time to time, one person
typically defines, constructs and manipulate the database. However many persons are
involved in the design, use and maintenance of a large database with few hundred users.
1. Database Design and
Database
End User
End User
End User
End User
Application Programs
• Firstly, we will identify the people whose jobs involve the day-to-day use of a large
database system. We will call them the “Actors on the Scene” or “Database Users”.
• Secondly, we will identify the people who are associated with the design,
development and operation of the DBMS software and system environment. We will call
them the “Workers behind the Scene”. These persons are typically not interested in the
database itself.
Actors on the Scene (Database Users)
• We can identify four distinct types of database users:
Data and Database Administrators
Database Designers
Application Programmers or Application Developers
End Users
Data and Database Administrators
• The database and the DBMS are corporate resources that must be managed like any
other resource.
• Data Administration (DA) and Database Administration (DBA) are the roles
generally associated with the management and control of a DBMS and its data.
• Data Administrator is a person in the enterprise who has the central responsibility for
the data.
• Thus it is the Data Administrator’s job to decide what data should be stored in the
database in the first place and to establish policies for maintaining and dealing with that data
once it has been stored.
• An example of such a policy might be one that dictates the enterprise which data to be
made public and which data to be kept as confidential.
Conceptual Data 1.1
• Note carefully that the Data Administrator is a manager (decision maker) and not a
technician (although he or she certainly does need to have some appreciation of the
capabilities of database system at a technical level).
• The technical person responsible for implementing the data administrator’s decisions
is the Database Administrator (DBA). The DBA unlike the Data Administrator is an IT
professional.
• The job of DBA is to create the actual database and to implement the technical
controls needed to enforce various policy decisions made by the DA (Data Administrator).
• The DBA is also responsible for ensuring that the DBMS operates with adequate
performance and for providing a variety of technical services.
• The DBA is typically assisted by a team of Application Programmers and other
technical persons.
• In small organizations sometimes there is no distinction between the role of DA and
DBA, in others they perform their duties as stated above.
• We shall later on discuss the specific responsibilities of DBA in detail.
Database Designers
• Database designers are responsible for identifying the data to be stored in the database
and for choosing appropriate structures to represent and store this data.
• In large design projects we can distinguish between two types of designer: logical
database designers and physical database designers.
• Logical Database Designer is concerned with identifying the data (i.e. the entities and
attributes), the relationships between the data, and the constraints on the data that is to be
stored in the database. In essence it can be said that Logical Database Designer derives the
Conceptual View (note that not the Conceptual Schema).
• The Physical Database Designer decides how the logical database design created by
logical database designer is to be physically realized i.e. he decides specific storage structures
and access methods for the data to achieve good performance. In essence it can be said that
the physical database designer derives the Internal View (note that not the Internal Schema).
• The tasks related to database designers are undertaken before the database is actually
implemented and populated with data.
• It is the responsibility of the database designers to communicate with all prospective
database users, in order to understand their requirements and to come up with a design
(certainly in consultation with the DA) that meets these requirements.
• In many cases, the designers are on the staff of the DBA.
• Database Designers typically interact with each potential group of users and develop a
view of the database that meets the data and processing requirements of this group. These
views
1. Database Design and
are then analyzed and integrated with the views of other user groups. The final database
design must be capable of supporting the requirements of all user groups.
Application Programmers/ Developers
• Once the database has been implemented, the application programs that provide the
required functionality to the end users or they satisfy the personal needs of the application
programmers are developed.
• This is the responsibility of Application Programmers. To access the database they
use some (3GLs) programming language such as C, C++, COBOL, Java etc or some higher-
level “fourth generation” language (4GL).
• Such programs access the database by issuing the appropriate request – typically an
embedded SQL statement – to the DBMS.
End Users
• The end-users are the clients for the database which has been designed and
implemented, and is being maintained to serve their information needs.
• End users may be classified according to the way they use the system:
Naive Users:
• They are typically unaware of the DBMS. They access database through specially
written application programs (by application programmers) which attempt to make the
operations as simple as possible.
• They invoke database operations by entering simple commands or choosing options
from a menu. This means that they do not need to know anything about the database or
DBMS.
• The best example is the person booking seats on a Railway Reservation Counter.
Data models can be classified into three major groups. They are:
Object -Based Data models
Record -Based Data models
Physical Models
Conceptual Data 1.1
b) Object-oriented model
c) Semantic model
d) Functional model
a) Entity-Relationship Model
Entity: An Entity is an object or a thing such as person, place about which an organization
keeps information. Any two objects or things are distinguishable.
E.g.: Each student is an entity.
Attribute: The describing properties of an entity are called Attributes.
e.g.: For a student entity, name, sex, date of birth are attributes.
Relationship: An association among entities is called a relationship.
The data model that consists of a set of entities and a set of relationships among those entities
is called ER Model.
The set of all entities of the same type is called an entity set and the set of all relationship of
the same type are called a relationship set.
a) Relational Model:
A data model in which both data and their relationships are represented by means of tables is
called Relational Model.
The relation is the only data structure used in this model to represent both entities and their
interrelationships. A relation is a two dimensional table with a unique name.
Each row of a table is called a tuple and each column of a table is called an attribute. The set
of all possible values in an attribute is called the domain of the attribute.
account-number balance
A-101 500
A-201 900
A-215 700
A-217 750
b) Network Model:
The network model uses two different structures. The data are represented by a collection of
records and the relationships among data are represented by links.
c) Hierarchical Model:
In Hierarchical Model, data are represented by records and relationships among data are
represented by links. But unlike in Network model, data are organized in an ordered tree
structure, which is called Hierarchical structure.
1. Database Design and
A DBMS must furnish a mechanism for recovering the database in the event that the database
is damaged in any way.
(6) Authorization services
A DBMS must furnish a mechanism to ensure that only authorized users can access the
database.
(7)Support for data communication
A DBMS must be capable of integrating with communication software.
(8) Integrity services
A DBMS must furnish a means to ensure that both the data in the database and
changes to the data follow certain rules.
(9) Services to promote data independence
A DBMS must include facilities to support the independence of programs from the
actual structure of the database.
(10) Utility services
A DBMS should provide a set of utility services.
A user view defines what is required of a database system in terms of the data to be
held and the transactions to be performed on the data (in other words, what the users will do
with the data). The requirements of a user view may be distinct to that view or overlap with
other views. Figure 10.2 is a diagrammatic representation of a data-base system with multiple
user views (denoted user view 1 to 6). Note that whereas user views (1, 2, and 3) and (5 and
6) have overlapping requirements (shown as hatched areas), user view 4 has distinct
requirements.
Figure 10.2 Representation of a database system with multiple user views: user views (1, 2, and 3) and (5 and
6) have overlapping requirements (shown as hatched areas), whereas user view 4 has distinct requirements.
Figure 10.4 The view integration approach to managing multiple user views 1 to 3.
The bottom-up approach is appropriate for the design of simple databases with a
relatively small number of attributes. However, this approach becomes difficult when applied
to the design of more complex databases with a larger number of attributes, where it is
difficult to establish all the functional dependencies between the attributes. As the conceptual
and logical data models for complex databases may contain hundreds to thousands of
attributes, it is essential to establish an approach that will simplify the design process. Also,
in the initial stages of establishing the data requirements for a complex database, it may be
difficult to establish all the attributes to be included in the data models.
1. Database Design and
A more appropriate strategy for the design of complex databases is to use the top-down
approach. This approach starts with the development of data models that contain a few high-
level entities and relationships and then applies successive top-down refinements to identify
lower-level entities, relationships, and the associated attributes. The top-down approach is
illustrated using the concepts of the Entity-Relationship (ER) model, beginning with the
identification of entities and relationships between the entities, which are of interest to the
organization.
The two main purposes of data modeling are to assist in the understanding of the meaning
(semantics) of the data and to facilitate communication about the information requirements.
Building a data model requires answering questions about entities, relationships, and
attributes. In doing so, the designers discover the semantics of the enterprise’s data, which
exist whether or not they happen to be recorded in a formal data all enterprises. However,
their meaning may remain poorly understood until they have been correctly documented. A
data model makes it easier to understand the meaning of the data, and thus we model data to
ensure that we understand:
Data models can be used to convey the designer’s understanding of the information
requirements of the enterprise.
An optimal data model should satisfy the criteria listed in Table 10.2 (Fleming and Von
Halle, 1989). However, sometimes these criteria are incompatible with each other and trade-
offs are sometimes necessary. For example, in attempting to achieve greater expressibility in
a data model, we may lose simplicity.
The process of constructing a model of the data used in an enterprise based on a specific data
model, but independent of a particular DBMS and other physical considerations.
The second phase of database design is called logical database design, which results in the
creation of a logical data model of the part of the enterprise that we interested in modeling.
The conceptual data model created in the previous phase is refined and mapped onto a logical
data model. The logical data model is based on the target data model for the database (for
example, the relational data model).
Throughout the process of developing a logical data model, the model is tested and
validated against the users’ requirements. The technique of normalization is used to test the
correctness of a logical data model.
feedback between physical and logical design, because decisions are taken during physical
design for improving performance that may affect the structure of the logical data model.
In general, the main aim of physical database design is to describe how we intend to
physically implement the logical database design. For the relational model, this involves:
Creating a set of relational tables and the constraints on these tables from the
information presented in the logical data model;
Identifying the specific storage structures and access methods for the data to achieve
an optimum performance for the database system;
Designing security protection for the system.
Ideally, conceptual and logical database design for larger systems should be separated from
physical design for three main reasons:
It deals with a different subject matter—the what, not the how;
It is performed at a different time—the what must be understood before the how can
be determined;
It requires different skills, which are often found in different people.
additional software/hardware required to support the database system, and the costs
associated with changeover and staff training.
A simple approach to selection is to check off DBMS features against requirements.
In selecting a new DBMS product, there is an opportunity to ensure that the selection process
is well planned, and the system delivers real benefits to the enterprise. In the following
section we describe a typical approach to selecting the “best” DBMS.
The World Wide Web is an excellent source of information and can be used to identify
potential candidate DBMSs. For example, InfoWorld’s online technology test center
(available at www.infoworld/test-center.com) provides a comprehensive review of DBMS
products. Vendors’ Web sites can also provide valuable information on DBMS products.
Evaluate products
There are various features that can be used to evaluate a DBMS product. For the
purposes of the evaluation, these features can be assessed as groups (for example, data
definition) or individually (for example, data types available). Table 10.4 lists possible
features for DBMS product evaluation grouped by data definition, physical definition,
accessibility, transaction handling, utilities, development, and other features.
If features are checked off simply with an indication of how good or bad each is, it
may be difficult to make comparisons between DBMS products. A more useful approach is to
weight features and/or groups of features with respect to their -importance to the organization,
and to obtain an overall weighted value that can requirements” are given a weighting of 0.00
and are therefore not included in this evaluation.
1. Database Design and
We next sum all the scores for each evaluated feature to produce a total score for the
group. The score for the group is then itself subject to a weighting, to indicate its importance
relative to other groups of features included in the evaluation. For example, in Table 10.5, the
total score for the “Physical definition” group is 5.75; however, this score has a weighting of
0.25.
Finally, all the weighted scores for each assessed group of features are summed to
produce a single score for the DBMS product, which is compared with the scores for the other
products. The product with the highest score is the “winner".
In addition to this type of analysis, we can also evaluate products by allowing vendors
to demonstrate their product or by testing the products in-house. In-house evaluation involves
creating a pilot testbed using the candidate products. Each product is tested against its ability
to meet the users’ requirements for the database system. Benchmarking reports published by
the Transaction Processing Council can be found at www.tpc.org.
Update transactions are used to insert new records, delete old records, or modify existing
records in the database. For example, the operation to insert the details of a new property into
the database is an example of an update transaction.
Conceptual Data 1.3
Mixed transactions involve both the retrieval and updating of data. For example, the
operation to search for and display the details of a property (given the property number) and
then update the value of the monthly rent is an example of a mixed transaction.
Meaningful title
The information conveyed by the title should clearly and unambiguously identify the purpose
of the form/report.
Comprehensible instructions
Familiar terminology should be used to convey instructions to the user. The instruc-tions
should be brief, and, when more information is required, help screens should be made
available. Instructions should be written in a consistent grammatical style, using a standard
format.
allows a user to consider the appropriate format for the data before entering the values into a
field.
Error correction for individual characters and entire fields A user should easily identify
the operation required to make alterations to field values. Simple mechanisms should be
available, such as using the Backspace key or overtyping.
Error messages for unacceptable values
If a user attempts to enter incorrect data into a field, an error message should be
displayed. The message should inform the user of the error and indicate permissible
values.
Completion signal
It should be clear to a user when the process of filling in fields on a form is complete.
However, the option to complete the process should not be automatic, as the user may
wish to review the data entered.
1.4.7. Prototyping
Building a working model of a database system. A prototype is a working model
that does not normally have all the required features or provide all the functionality of the
final system. The main purpose of developing a prototype database system is to allow
users to use the prototype to identify the features of the system that work well or are
inadequate, and—if possible—to suggest improvements or even new features to the
database system. There are two prototyping strategies in common use today:
requirements proto-typing and evolutionary prototyping.
Requirements prototyping uses a prototype to determine the requirements of a
proposed database system, and once the requirements are complete, the prototype is
discarded. Although evolutionary prototyping is used for the same purposes, the
important difference is that the prototype is not discarded, but with further development
becomes the working database system.
1.4.8. Implementation
The physical realization of the database and application designs.
Conceptual Data 1.3
The database implementation is achieved using the DDL of the selected DBMS or a GUI,
which provides the same functionality while hiding the low-level DDL statements. The
DDL statements are used to create the database structures and empty database files. Any
specified user views are also implemented at this stage.
The application programs are implemented using the preferred third- or fourth-
generation language (3GL or 4GL). Parts of these application programs are the database
transactions, which are implemented using the DML of the target DBMS, possibly
embedded within a host programming language, such as Visual Basic (VB), VB.net,
Python, Delphi, C, C++, C#, Java, COBOL, Fortran, Ada, or Pascal. We also implement
the other components of the application design such as menu screens, data entry forms,
and reports.
Again, the target DBMS may have its own fourth-generation tools that allow
rapid development of applications through the provision of nonprocedural query
languages, reports generators, forms generators, and application generators.
Security and integrity controls for the system are also implemented. Some of these
controls are implemented using the DDL,
1.4.10. Testing
The process of running the database system with the intent of finding errors.
Testing should also cover usability of the database system. Ideally, an evaluation
should be conducted against a usability specification. Examples of criteria that can be
used to conduct the evaluation include the following (Sommerville, 2010):
Learnability: How long does it take a new user to become productive with the
system?
Performance: How well does the system response match the user’s work practice?
Robustness: How tolerant is the system of user error?
Recoverability: How good is the system at recovering from user errors?
Adaptability: How closely is the system tied to a single model of work?
Some of these criteria may be evaluated in other stages of the lifecycle. After testing is
complete, the database system is ready to be “signed off” and handed over to the users.
Entity types
Relationship types
Attributes
Relationship type
– Set of meaningful associations among entity types.
Relationship occurrence
– Uniquely identifiable association, which includes one occurrence from
each participating entity type.
Semantic net of Has relationship type
1. Database Design and
1.5.2.2.Recursive Relationship
– Relationship type where same entity type participates more than once in
different roles.
– Relationships may be given role names to indicate purpose that each
participating entity type plays in a relationship.
1.5.3 Attributes
1. Database Design and
Attribute
o Property of an entity or a relationship type.
Attribute Domain
o Set of allowable values for one or more attributes.
1.5.3.1. Attribute types
1.5.3.2. Keys
Conceptual Data 1.3
A key allows us to identify a set of attributes and thus distinguishes entities from each
other. Keys also help to uniquely identify relationships, and thus distinguish relationships
from each other.
2. Candidate key
3. Primary key
4. Foreign key
1. Super key: A super key is a set of one or more attributes that, taken
collectively, allow us to identify uniquely a tuple in the relation. For example, consider
the student relation.
Student (Rollno, Name, Age) is a Super key.
2. Candidate key: A table which have more than one attribute that uniquely
identify an instance of an entity set. These attributes are called Candidate keys.
For example, Consider the car relation,
Car (license_no, engine_serial_no, make, model, year) In this relation, we can find the two
Candidate keys:
license_no and engine_serial_no.
3. Primary key: An attribute which is unique and not null, can identify an
instance of the entity set is termed as Primary key.
For example, Consider the employee relation,
Employee (eno, ename, sex, doj, dob, sal, job, dno) in this eno is the Primary key.
4. Foreign key: An attribute in one relation whose value matches the primary
key in some other relation is called a Foreign key.
For example, Consider the two relations dept and employee,
Structural Constraints
Main type of constraint on relationships is called multiplicity.
Multiplicity - number (or range) of possible occurrences of an entity type that
may relate to a single occurrence of an associated entity type through a particular
relationship.
Represents policies (called business rules) established by user or company.
Mapping Cardinalities
Mapping cardinalities or Cardinality ratio is defined as the number entities to which
another entity can be associated via a relationship set.
For a binary relationship set R between entity sets A and B, the mapping cardinality
must be one of the following
(i) One-to-one (1 : 1)
(a) (b)
Fig. 2.4 One-to-One & One-to-Many
(ii) One-to-many (1 : M)
(iii) Many-to-Many (M : N)
(c) (d)
Fig. 2.5 Many-to-Many & Many-to-One
1. Database Design and
1.6.1.4 Specialization
– Process of maximizing differences between members of an entity by
identifying their distinguishing characteristics.
1.6.1.5 Generalization
Process of minimizing differences between entities by identifying their common
characteristics.
All Staff relation holding details of all staff
1.8 COMPOSITION
Specific form of aggregation that represents an association between entities,
where there is a strong ownership and coincidental lifetime between the ‘whole’ and the
‘part’.
Example of Composition
1.9.UML DIAGRAMS
UML defines a number of diagrams, of which the main ones can be divided into
the following two categories:
a) Object diagrams
Object diagrams model instances of classes and are used to describe the system at
a particular point in time.
1. Database Design and
b) Component diagrams
Component diagrams describe the organization and dependencies among physical
software components, such as source code, runtime (binary) code, and executables.
A component is represented by a rectangle with two tabs overlapping the left edge. A
dependency is denoted by a dotted arrow going from a component to the component it
depends on.
c) Deployment diagrams
Deployment diagrams depict the configuration of the runtime system, showing the
hardware nodes, the components that run on these nodes, and the connections between
nodes. A node is represented by a three-dimensional cube.
e) Sequence diagrams
A sequence diagram models the interactions between objects over time, capturing
the behavior of an individual use case. It shows the objects and the messages that are
passed between these objects in the use case. In a sequence diagram, objects and actors
are shown as columns, with vertical lifelines indicating the lifetime of the object over
time. An activation/focus of control, which indicates when the object is performing an
action, is modeled as a rectangular box on the lifeline; a lifeline is represented by a
vertical dotted line extending from the object. The destruction of an object is indicated by
an X at the appropriate point on its lifeline.
1. Database Design and
f) Collaboration diagrams
A collaboration diagram is another type of interaction diagram, in this case showing the
interactions between objects as a series of sequenced messages. This type of diagram is a
cross between an object diagram and a sequence diagram.
g) Statechart diagrams
Statechart diagrams, sometimes referred to as state diagrams, show how objects
can change in response to external events. Other behavioral diagrams typically model the
interaction between multiple objects; statechart diagrams usually model the transitions of
a specific object.
the notation is simple, consisting of a few symbols:
• States are represented by boxes with rounded corners.
• Transitions are represented by solid arrows between states labeled with the “eventname/
action” (the event triggers the transition and action is the result of the transition).
Conceptual Data 1.4
For example, in Figure 27.23, the transition from state Pending to Available is triggered
by an approveProperty event and gives rise to the action called makeAvailable().
• Initial state (the state of the object before any transitions) is represented by a solid circle
with an arrow to the initial state.
• Final state (the state that marks the destruction of the object) is represented by a solid
circle with a surrounding circle and an arrow coming from a preceding state.
h) Activity diagrams
Activity diagrams model the flow of control from one activity to another. An
activity diagram typically represents the invocation of an operation, a step in a business
process, or an entire business process. It consists of activity states and transitions between
them.
1.5 Database Design and
Conceptual Data 1.5
a) Banking
b) Airlines
c) Universities
1. What is an entity relationship model?
The entity relationship model is a collection of basic objects called entities and
relationship
among those objects. An entity is a thing or object in the real world that is distinguishable
from other objects.
2. What are attributes? Give examples.
An entity is represented by a set of attributes. Attributes are descriptive properties
possessed by each member of an entity set.
Example: possible attributes of customer entity are customer name, customer id,
Customer Street, customer city.
3. What is an entity?
An entity is an object that exists and is distinguishable from other objects. Example:
specific person, company, event, plant
4. Define the terms: i) Entity set ii) Relationship set
Entity set: The set of all entities of the same type is termed as an entity set. Relationship
set : The set of all relationships of the same type is termed as a relationship set.
PART - B
PART - C
a. Banking system
c. Payroll system
2. Construct an ER diagram for a car-insurance company whose customers own one
or more cars each. Each car has associated with its zero to any number of record
accidents. State any assumptions you make.
3. Construct an ER diagram for university registrar’s office. The office maintains data
about each class, including the instructor, the enrollment and the time and place of the
class meetings. For each student class pair a grade is recorded.Determine the entities and
relationships.
4. Construct an ER diagram for a car insurance company that has a set of customers, each
of whom owns one/more cars. Each car has associated with it zero to any number of recorded
accidents
5. Draw an E-R diagram for a small marketing company database, assuming your own
data requirements
Database Design and Management
55.1
55