DDM Notes (1)-Converted
DDM Notes (1)-Converted
CONCEPTUALDATAMODELING
SYLLABUS
Database environment – Database system development lifecycle –
1.1 Definition:
Program-Data Dependence
All programs maintain metadata for each file they use „
Duplication of Data „
Different systems/programs have separate copies of the same data „
Limited Data Sharing
No centralized control of data
Lengthy Development Times „
Programmers must design their own file formats „
Excessive Program Maintenance„
80% of information systems budget
Problems with Data Redundancy
Database-System Applications.
Banking-For customer information,account activities,payments,deposits,loans etc.
Airlines-For reservations and schedule information.
Universities- For student information,course registrations,colleges and grades.
Telecommunications-It helps to keep call records,monthly bills
maintaining balances etc.
Finance: For storing information about stock, sales and purchases of
financial instruments like stocks and bonds.
Accounting: Database systems are used in maintaining information
employees, salaries and payroll taxes
Manufacturing: For management of supply chain and tracking production of
items in factories database systems are maintained.
Reservations Systems: In airline/railway reservation systems, the database is
used to maintain the reservation and schedule information.
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.
Integrity problems
The data values stored in the database must satisfy certain types of
consistency constraints.
Atomicity problems
A computer system, like any other device, is subject to failure. In many
applications, it is crucial that, if a failure occurs, the data be restored to the
consistent state that existed prior to the failure.
Concurrent-access anomalies
For the sake of overall performance of the system and faster response, many
systems allow multiple users to update the data simultaneously.
Security problems
Not every user of the database system should be able to access all the data.
For example, in a university, payroll personnel need to see only that part of the
database that has financial information.
Advantages of DBMS:
Redundancy can be reduced
Inconsistency can be avoided
The data can be shared
Standards can be enforced
Security can be enforced
Integrity can be maintained
Disadvantages of DBMS:
Confidentiality, Privacy and Security
Enterprise Vulnerability
The cost of using a DBMS
Database Systems Conventional File systems
Data redundancy is less Data redundancy is more
Security is high Security is very low
Database systems are used when Conventional file systems are used
security constraints are high where there is less demand for security
constraints.
Database systems define the data in a File systems define the data in un-
structured manner. Also there is well structured manner. Data is usually in
defined co-relation among the data. isolated form.
Data inconsistency is less in Data inconsistency is more in
database systems. database systems.
This code defines a new record type called instructor with four fields. Each field has a
name and a type associated with it. A university organization may have several
such record types, including
o department, with fields dept name, building, and budget
o course, with fields course id, title, dept name, and credits
o student, with fields ID, name, dept name, and tot cred
Example:
Roll No Name Marks
Types of Schema:
Database systems have several schemas, partitioned according to the levels of
abstraction.
The physical schema describes the database design at the physical level of abstraction.
the logical schema describes the database design at the logical level of abstraction.
A database may also have several schemas at the view level, sometimes called
subschemas, that describe different views of the database.
•Procedural DMLs require a user to specify what data are needed and how to
get those data.
•Declarative DMLs (also referred to as nonprocedural DMLs) require a user to specify
what data are needed without specifying how to get those data.
Data-Definition Language
Data Definition Language(DDL) is a specialized language used to specify a
database schema by a set of definitions.
It is a language which is used for creating and modifying the structure of tables, views
,indexes and so on.
DDL is also used to specify additional properties of data.
Some of the common commands used in DDL are CREATE,ALTER,DROP.
1.6 DATA MODELS
Underlying the structure of a database is the data model: a collection of
conceptual tools for describing data, data relationships, data semantics, and
consistency constraints.
Advantages
1. The main advantage of this model is its ability to represent data in a simplified
format.
2. The process of manipulating record is simplified with the use of certain key
attributes used to retrieve data.
3. Representation of different types of relationship is possible with this model.
A-101 1000.00
A-111 3000.00
The records in the database are organized as collection of arbitrary groups.
Advantages:
1. Representation of relationship between entities is implemented using
pointers which allows the representation of arbitrary relationship
2. Unlike the hierarchical model it is easy.
3. Data manipulation can be done easily with this model.
1.6.1.5 Hierarchical Model
A hierarchical data model is a data model which the data is organized into a
tree like structure. The structure allows repeating information using parent/child
relationships: each parent can have many children but each child only has one
parent(Fig 1.2). All attributes of a specific record are listed under an entity type.
1.7.Data Independence
A database system normally contains a lot of data in addition to users’ data.
For example, it stores data about data, known as metadata, to locate and
retrieve data easily.
It is rather difficult to modify or update a set of metadata once it is stored in
the database.
But as a DBMS expands, it needs to change over time to satisfy the
requirements of the users. If the entire data is dependent, it would become a
tedious and highly complex job.
Metadata itself follows a layered architecture, so that when we change
data at one layer, it does not affect the data at another level. This
data is independent but mapped to each other.
1. Internal Level
o The internal level has an internal schema which describes the physical
storage structure of the database.
o The internal schema is also known as a physical schema.
o It uses the physical data model. It is used to define that how the data will be
stored in a block.
o The physical level is used to describe complex low-level data structures in detail.
o Access paths.
For Example: Specification of primary and secondary keys, indexes, pointers and
sequencing.
o Data compression and encryption techniques.
o Optimization of internal structures.
o Representation of stored fields.
2. Conceptual Level
3. External Level
Information System:
Database planning
System definition
Requirements collection and analysis
Database design
DBMS selection (optional)
Application design
Prototyping (optional)
Implementation
Data conversion and loading
Testing
Operational maintenance
System Definition
Describes scope and boundaries of database system and the major user views.
User view defines what is required of a database system from perspective of:
a particular job role (such as Manager or Supervisor) or
enterprise application area (such as marketing, personnel, or stock control).
centralized approach;
view integration approach;
combination of both approaches.
I) Centralized approach
Requirements for each user view are merged into a single set of requirements.
A data model is created representing all user views during the database design
stage.
Fig 2.1 Centralized Approach to Managing Multiple User Views
Application Design:
Design of user interface and application programs that use and process the
database.
Database design and application design are parallel activities.
Prototyping:
Implementation
Testing
Operational Maintenance
Fig:3.1 ER Model
b) Attributes:
The properties that describe an entity are called
attributes. In the customer entity customer id, name,
street are the attributes. An attribute can be classified
into various types.
Simple Attribute: An attribute that cannot be divided into further subparts.
3.2 Constraints:
An E-R enterprise schema may define certain constraints to which the constraints to
which the contents of a database must conform.
Two types of constraints are
1. Mapping cardinalities
2. Participation constraint
1. Mapping Cardinalities
Mapping Cardinalities or Cardinality ratio is defined as the number of times an
entity of an entity set participates in a relationship set is known as cardinality.
Cardinality can be of different types:
One to one – When each entity in each entity set can take part only once
in the relationship, the cardinality is one to one.
Many to many – When entities in all entity sets can take part
2. Participation Constraints:
It specifies whether the existence of an entity depends on its being related to
another entity via the relationship type.
Types:
1) Total participation
Every member of entity set must participate in the relationship
Represented by double line from entity rectangle to relationship diamond.
E.g., Every entity in “total set” of employee entities must be related to a
department entity via, WORKS FOR.
2) Partial participation
Not every entity instance must participate
Represented by single line from entity rectangle to relationship diamond
E.g., Not every employee manages a department, so the participation of
employee in the manages relationship type is partial. “Part of the set of”
employee entities are related to the department entity via manages
relationship.
4.2 Generalization
The refinement from an initial entity set into successive levels of entity
subgroupings represents a top-down design process in which distinctions are made
explicit.
Higher- and lower-level entity sets also may be designated by the terms superclass
and
subclass, respectively.
In generalization, a number of entities are brought together into one
generalized entity based on their similar characteristics.
For example, pigeon, house sparrow, crow and dove can all be generalized as Birds.
User-defined
User-defined lower-level entity sets are not constrained by a membership
condition; rather, the database user assigns entities to a given entity set.
In this constraint the decision is left to the super class that how many instances
of the super class will be participating in the sub class.
In the given example Team leader decides which team will join according to skills.
Attribute defined
This refers to specifying conditions on more than one attribute.
Example
Consider a database for the marks and attendance.
This type of constraint is defined on two or more attributes for the given entity
which is further divided into subclass entities.
Overlapping
Two or more instances of the super class are participating in two or more sub
classes then it is called overlapping constraints.
Example
A person who knows Java and PHP can participate in both teams.
4.5 Aggregation
One limitation of the E-R model is that it cannot express relationships
among relationships.
The best way to model a situation such as the one just described is to use
aggregation.
Aggregation is an abstraction through which relationships are treated as
higher-level entities
Fig .4.5 Aggregation
o Upper Section: The upper section encompasses the name of the class. A class
is a representation of similar objects that shares the same relationships,
attributes, operations, and semantics. Some of the following rules that should
be taken into account while representing a class are given below:
Middle Section: The middle section constitutes the attributes, which describe the quality
of the class. The attributes have the following characteristics:
. The attributes are written along with its visibility factors, which are public (+),
private (-), protected (#), and package (~).
a. The accessibility of an attribute class is illustrated by the visibility factors.
b. A meaningful name should be assigned to the attribute, which will
explain its usage inside the class.
Lower Section: The lower section contains methods or operations. The methods are
represented in the form of a list, where each method is written in a single line. It
demonstrates how a class interacts with data.
5.4 Relationships
In UML, relationships are of three types:
o Dependency: A dependency is a semantic relationship between two or more
classes where a change in one class cause changes in another class. It forms
a weaker relationship.
In the following example, Student_Name is dependent on the Student_Id.
A contact book consists of multiple contacts, and if you delete the contact book, all
the contacts will be lost.
5.6 Abstract Classes
In the abstract class, no objects can be a direct entity of the abstract class. The
abstract class can neither be declared nor be instantiated. It is used to find the
functionalities across the classes. The notation of the abstract class is similar to that
of class; the only difference is that the name of the class is written in italics. Since it
does not involve any implementation for a given function, it is best to use the
abstract class with multiple objects.
Let us assume that we have an abstract class named displacement with a method
declared inside it, and that method will be called as a drive (). Now, this abstract
class method can be implemented by any object, for example, car, bike, scooter,
cycle, etc.
The class diagram is used most widely to construct software applications. It not only
represents a static view of the system but also all the major aspects of an
application. A collection of class diagrams as a whole represents a system.
Some key points that are needed to keep in mind while drawing a class diagram are
given below:
A database administrator (short form DBA) is a person responsible for the design,
implementation, maintenance and repair of an organization's database. They are
also known bythe titles Database Coordinator or Database Programmer, and is
closely related to the DatabaseAnalyst, Database Modeller, Programmer Analyst,
and Systems Manager.
The role includes the development and design of database strategies, monitoring and
improving database performance and capacity, and planning for future expansion
requirements. They may also plan, co-ordinate and implement security measures to
safeguard the database
2. What is a data model? List the types of data model used. April/May-2011
Physical schema: The physical schema describes the database design at the physical
level, which is the lowest level of abstraction describing how the data are actually
stored.
Logical schema: The logical schema describes the database design at the logical level,
which describes what data are stored in the database and what relationship exists among
the data.
Example: possible attributes of customer entity are customer name, customer id,
Customer Street, customer city.
20. What is relationship? Give examples
A relationship is an association among several entities.
Example: A depositor relationship associates a customer with each account that he/she
has.
Relationship set : The set of all relationships of the same type is termed as a relationship
set.
Single valued attributes: attributes with a single value for a particular entity are
called single valued attributes.
Multivalued attributes : Attributes with a set of value for a particular
entity are Called multivalued attributes.
i) Key attribute
ii) Value set
Key attribute : An entity type usually has an attribute whose values are distinct from each
individual entity in the collection. Such an attribute is called a key attribute.
Value set: Each simple attribute of an entity type is associated with a value set that
specifies the set of values that may be assigned to that attribute for each individual
entity.
Weak entity set: entity set that do not have key attribute of their own are called
weak entity sets. Strong entity set: Entity set that has a primary key is termed a
strong entity set.
PART-B
1. Explain the three different groups of data models with suitable examples.
2. i) Explain the concepts of specialization and generalization in E-R data modeling
ii) Explain three schema architecture in detail with a neat diagram
3. i) Draw the ER diagram for banking systems.
4. Explain Entity relational model with a neat diagram.
5. Explain EER model?
6. Explain the concept of UML class diagram?
7. Explain the three types of data model in detail?
8. Explain Database System Management Life cycle in detail ?