Professional Documents
Culture Documents
What is Data?
Data is a collection of Facts (or) Information such as numbers, characters, words etc..
(or)
Data can be Qualitative (or) Quantitative
DATA
Qualitative Quantitative
Ex: “My name is hari”
Limitations:
1. Separated and Isolated Data - Makes coordinating, representing is data difficult.
2. Data Duplication - Wastes space and can lead to data integrity (inconsistency) problems.
3. Application Program Dependencies - Changes to a single file can require changes to numerous
application programs
INTRODUCTION
5. Atomicity problems
- A computer system (or) any other devices subject to failure. [ Once failure has
occurred and has been detected, the data are restored to the consistent state existed
prior to the failure.
6. Concurrent access anomalies
- Multiple user may update the data simultaneously.
7. Security problem
- Not every user of the database system should be able to access all the data. It is
difficult to enforce such security constrains.
INTRODUCTION
What is DBMS?
DATABASE MANAGEMANT SYSTEM
A database is refers to a collection of related data and the way of it is organized, access
to this data is usually provided by a database management system.
DBMS is a collection of program ( or) software application that interact with user and
other application software.
INTRODUCTION
2. Oracle
3. FoxPro
4. SQLite
5. Firebird
6. Microsoft SQL Server
7. Postgre SQL
8. IBM DB2
9. SAP Sybase
10. R:Base
11. MYSQL
Types of Database?
DBMS is a computer software application used to manage a database.
There are Six main types of (DB) and these are based upon their management of database
structures:
1. Hierarchical DB
A hierarchical database model is a data model in which the data is organized into a tree-like
structure.
The data is stored as records which are connected to one another through links.
A record is a collection of fields, with each field containing only one value.
This structure is simple but inflexible because the relationship is confined to a one-to-many
relationship
Currently hierarchical databases are still widely used especially in applications that require
very high performance and availability such as banking and telecommunications
Another example of the use of hierarchical databases is Windows Registry in the Microsoft
Windows operating systems.
Structure Example:
INTRODUCTION
2. Network DB
The network model is a data model conceived as a flexible way of representing
their relationships.
Looks like several trees which share branches.
Many-to-Many relationship
Structure Example:
INTRODUCTION
3. Relational DB
A relational database management system (RDBMS) is a database management
system(DBMS) that is based on the relational model as invented by E. F. Codd, of
IBM's San Jose Research Laboratory.
Many popular databases currently in use are based on the relational data base model.
RDBMSs are a common choice for the storage of information in new databases used
for financial records, manufacturing and logistical information, personnel data, and
other applications since the 1980s.
the most popular database management systems are Oracle, MySQL, Microsoft SQL
Server, PostgreSQL and IBM DB2.
4. Object DB
An object database (also object-oriented database management system) is a database
management system in which information is represented in the form of objects as used in object
oriented programming .
handle many new data types, including graphics, photographs, audio, and video, object-oriented
databases represent a significant advance over their other database.
Note:
Hierarchical and network databases are all designed to handle structured data;
that is,
Data that fits nicely into fields, rows, and columns.
They are useful for handling small snippets of information such as names, addresses, zip
codes, product numbers, and any kind of statistic or number you can think of.
On the other hand,
An object-oriented database can be used to store data from a variety of media sources,
such as photographs and text, and produce work, as output, in a multimedia format.
5. Mobile DB
A mobiledatabase is either a stationary database that can be connected to by a
mobile computing over a mobile network.
This could be a list of contacts, price information, distance travelled, or any other
information.
Example:
1. SQLite
6. Cloud DB
A cloud database is a database that typically runs on a cloud computing platform.
Meta-data is defined as the data providing information about one or more aspects of the
data, such as:
Creation of the data / Purpose of the data / Time and date of creation / Creator or author of the
data
Location on a computer network where the data was created / Standards used
INTRODUCTION
There are several functions that a DBMS performs to ensure data integrity and
consistency of data in the database.
The Ten functions in the DBMS are:
1. Data dictionary management
Data Dictionary is where the DBMS stores definitions of the data elements and their
relationships (metadata). The DBMS uses this function to look up the required data
component structures and relationships.
2. Data storage management
Data storage management is used for the storage of data and any related data.
3. Data transformation and presentation
By using the data transformation and presentation function the DBMS can determine
the difference between logical and physical data formats.
Ex:
Logical data is data about database. (It stores information about how data is
managed inside DB)
Physical data the actual data is stored in bit format on the disk.
INTRODUCTION
4. Security management
This is one of the most important functions in the DBMS. Security management sets
rules that determine specific users that are allowed to access the database. (Users are
given a username and password)
5. Multiuser access control
Data integrity and data consistency are the basis of this function. it enables multiple
users to access the database simultaneously without affecting the integrity of the
database.
6. Backup and Recovery management
Backup and recovery is brought to mind whenever there is potential outside threats to
a database.
7. Data integrity management
The DBMS enforces these rules to reduce things such as data redundancy, which is
when data is stored in more than one place unnecessarily, and maximizing data
consistency, making sure database is returning correct/same answer each time for
same question asked.
INTRODUCTION
Example:
UNIVERSITY database for maintaining information concerning students,
courses, and grades in a university environment.
The database is organized as five files, each of which stores data records of
the same type:
1. The STUDENT file stores data on each student.
2. The COURSE file stores data on each course.
3. The SECTION file stores data on each section of a course.
4. The GRADE_REPORT file stores the grades that students receive in the
various sections they have completed.
5. The PREREQUISITE file stores the prerequisites of each course.
INTRODUCTION
Notice that records
in the various files
may be related.
INTRODUCTION
Example:
RAILWAY reservation database
CHARACTERISTICS OF DATABASE APPROACH
An example of a
database catalog
for
the database.
CHARACTERISTICS OF DATABASE APPROACH
Advantages of using a DBMS and the capabilities that a good DBMS should possess.
These capabilities are in addition to the four main characteristics (Refer above):
1. Controlling Redundancy ( Storing the same data multiple times leads to several
problems)
2. Restricting Unauthorized Access
3. Providing Persistent Storage for Program Objects ( Database can be used to provide
persistent storage for program objects and data structure)
Note: In traditional data base system suffer from “ Impedance mismatch
problem”.
1. Providing Storage Structures and Search Techniques for Efficient Query Processing
2. Providing Backup and Recovery
3. Providing Multiple User Interfaces
4. Representing Complex Relationships among Data
5. Enforcing Integrity Constraints (Business rules)
A BRIEF HISTORY OF DATABASE APPLICATIONS
Brief historical overview of the applications that use DBMSs and how these
applications provided the impetus for new types of database systems:
5. Extending Database Capabilities for New Applications like Banking, Airlines and railway
reservations, Universities, Telecommunication, Finance, Manufacturing and Sales, Human
Resources, E-Commerce, Scientific, Storage and Retrieval, Data Mining, Spatial, Weather
forecast etc..
Data abstraction:
Data abstraction generally refers to the suppression of details of data organization and storage, the
highlighting of the essential features for an improved understanding of data.
Data model:
A data model organizes data elements and standardized how the data elements relate to one
another. (It describes the structure of a database and also provide behavior of a database)
Note:
Structure means data types, constraints, relationships
Features:
Conceptual data model includes Entities and the relationship among them.
No attributes is specified.
No primary key is specified
DATA MODEL
Features:
Logical data model includes all entities and the relationship among them.
The primary key for each entity is specified.
All attributes for each entity are specified.
Foreign key ( key identifies the relation ship between different entities) are specified.
Normalization occurs at this level.
DATA MODEL
Features:
Specification all tables and columns. ( convert entities into tables and attributes into columns )
Foreign key are used to identify relationship between entities.
De-normalization may occur based on user requirements.
Physical considerations may cause the physical data model to be quite different from logical data
model.
Physical data model will be different for different RDBMS. ( Data types for a column may be
different between oracle, DB2, mysql etc..)
DATABASE SCHEMA
A database schema is the skeleton structure (or) description of the database that represents the
logical view of the entire database.
It defines how the data is organized and how the relations among them are associated.
It formulates all the constraints that are to be applied on the data.
DATABASE INSTANCE
The actual content of the database, the data, changes often over the years.
A database state at a specific time defined through the currently existing content and
relationship and their attributes is called a database instance. (The data in the
database at a particular moment of time is called an instance or a database state)
The following illustration shows that a database scheme could be looked at like a
template or building plan for one or several database instances.
DATABASE SCHEMA
In this architecture, the overall database description can be defined at three levels,
namely internal, conceptual, and external levels called as three-level DBMS
architecture (or) Three schema architecture.
This architecture is proposed by ANSI/SPARC (American National Standards
Institute/Standards Planning and Requirements Committee) and hence, is also
known as ANSI/SPARC architecture These three levels are used to describe the
schema of the database at various levels.
To separate the user applications from the physical database In this architecture, schemas can be
defined at the following three levels:
THE THREE-SCHEMA ARCHITECTURE
Data independence is the ability to change the schema at one level of the database system without
having to change the schema at the other levels.
Data independence is of two types, namely, logical data independence and physical data
independence.
DBMS Languages
<Refer Book>
DBMS Interfaces
<Refer Book>
DATA BASE SYSTEM ENVIRONMENT - COMPONENT MODULES OF A DBMS
COMPONENT MODULES OF A DBMS
Entity –Relationship (ER) modeling is an important step in information system design and
software engineering.
The ER model describe the basic data structuring concepts and constraints of the ER model and
discuss their use in the design conceptual schemas for database application.
The diagrammatic notation associated with the ER model is known as ER diagram, main
components of ER models are entities and their relationships.
DATA MODELING USING ENTITY RELATIONSHIP MODEL
(In s/w design it is common to use data flow diagram, sequence diagram, scenarios and other
techniques specified by functional requirements)
Company Database
DATA MODELING USING ENTITY RELATIONSHIP MODEL
An entity set is a set of entities of the same type that share the same properties at
any point in time.
Domain (Value set) – the set of permitted values for each attribute.
Entity type is like fruit is a class ,we haven't seen any "fruit“ yet though we have seen instance of
fruit like apple ,banana etc..
For example:
fruit=entity type=EMPLOYEE
apple=entity=e1 or e2 or e3
enity set= bucket of apple, banana ,mango etc={e1,e2......}
DATA MODELING USING ENTITY RELATIONSHIP MODEL
Keys:
Key is an uniquely identifies an entity among entity set.
For example,
1- Super Key 2- Candidate Key 3- Primary Key
4- Foreign Key 5- Alternate Key 6- Composite Key
Week Entity types: Entities based on their characteristics are classified as follows.
1- Strong Entity
An entity set that has a primary key is termed as strong entity set.
2- Weak Entity
An entity set that does not have sufficient attributes to form a primary key is termed as a
weak entity set. (partial key is used to identify other attributes of a weak entity set)
DATA MODELING USING ENTITY RELATIONSHIP MODEL
Attributes:
Entities are represented by means of their properties, called attributes.
All attributes have values. For example, a Employee entity may have name, Bdate, address, and
salary as attributes.
Several types of attributes are:
1. Simple
2. composite
3. Single valued
4. Multi valued
5. Stored and derived
3- Single valued
Most attributes have a single value for a particular entity; such attributes are called single-valued.
For example, Age is a single-valued attribute of a person.
4 - Multi valued
Multi-value attributes may contain more than one values. For example, a Employee can have
more than one phone number, email_address, etc.
5- Stored and derived
In some cases, two (or more) attribute values are related
for example, the Age and Birth_date attributes of a person.
For a particular person entity, the value of Age can be determined from the current (today’s) date
and the value of that person’s Birth_date.
The Age attribute is hence called a derived attribute and is said to be derivable from the Birth_date
attribute, which is called a stored attribute.
NULL Values
In some cases, a particular entity may not have an applicable value for an attribute.
Complex attributes
for example, a person can have more than one residence and each residence can have a single
address and multiple phones.
DATA MODELING USING ENTITY RELATIONSHIP MODEL
Relationships :
There are several implicit relationships among the various entity types.
An attribute of one entity type refers to another entity type, some relationship exists.
For example
The attribute Manager of DEPARTMENT refers to an employee who manages the
department.
The attribute Controlling_department of PROJECT refers to the department that
controls the project.
A relationship type R among n entity types (E1, E2, ..., En) defines a set of
associations—or a relationship set.
The relationship set (A set of relationships of similar type is called a relationship set)
R is a set of relationship instances ri,
where each ri associates n individual entities (e1, e2, ..., en),
each entity ej in ri is a member of entity set Ej,
DATA MODELING USING ENTITY RELATIONSHIP MODEL
Relationships : The relationship set WORKS_FOR associates one EMPLOYEE entity and one
DEPARTMENT entity.
DATA MODELING USING ENTITY RELATIONSHIP MODEL
Relationships :
A relationship type WORKS_FOR between the two entity types EMPLOYEE and
DEPARTMENT.
Employees e1, e3, and e6 work for department d1; employees e2 and e4 work for department d2;
and employees e5 and e7 work for department d3.
1- Strong Entity
An entity set that has a primary key is termed as strong entity set.
2- Weak Entity
An entity set that does not have sufficient attributes to form a primary key is termed as a
weak entity set. (partial key is used to identify other attributes of a weak entity set)
In ER modeling, notation for weak entity is given below.
NOTATION FOR ER DIAGRAMS
Attributes:
Entities are represented by means of their properties, called attributes.
In ER modeling, notation for attribute is given below.
Key attribute:
The attribute which is unique for every entity instance is called key attribute.
In ER modeling, notation for key attribute is given below.
NOTATION FOR ER DIAGRAMS
Multi valued attributes:
Multi-value attributes may contain more than one values. For example, a Employee can have
more than one phone number, email_address, etc.
In ER modeling, notation for multi-valued attribute is given below.
NOTATION FOR ER DIAGRAMS
Derived Attribute:
An attribute which can be calculated or derived based on other attributes is a derived attribute.
Cardinality of a Relationship
Advantages :
ER Modeling is simple and easily understandable. It is represented in business users language and
it can be understood by non-technical specialist.
Intuitive and helps in Physical Database creation.
Can be generalized and specialized based on needs.
Can help in database design.
Gives a higher level description of the system.
Disadvantages:
Physical design derived from E-R Model may have some amount of ambiguities or inconsistency.
Sometime diagrams may lead to misinterpretations
ENTITY RELATIONSHIP (ER) MODEL
Here we are going to design an Entity Relationship (ER) model for a college database
1. A college contains many departments
1. Department
2. Course
3. Instructor
4. Student
1. One department offers many courses. But one particular course can be offered by only one
department. hence the cardinality between department and course is One to Many (1:N)
2. One department has multiple instructors . But instructor belongs to only one department. Hence
the cardinality between department and instructor is One to Many (1:N)
3. One department has only one head and one head can be the head of only one department. Hence
the cardinality is one to one. (1:1)
4. One course can be enrolled by many students and one student can enroll for many courses.
Hence the cardinality between course and student is Many to Many (M:N)
5. One course is taught by only one instructor. But one instructor teaches many courses. Hence the
cardinality between course and instructor is Many to One (N :1)
ENTITY RELATIONSHIP (ER) MODEL
Step 3: Identify the key attributes
Company Database
ENTITY RELATIONSHIP (ER) DIAGRAMS
THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
What is the difference between ERD (Entity relationship diagram) and EERD (enhanced entity
relationship diagram) in database design?
ER model provides preliminary concepts or idea about the data representation which is later
modified to achieve final detailed design.
EER Model is for applications like –GIS, CAD/CAM, Telecommunication which are more
complex requirements than normal database applications.
To meet the requirements additional modeling concepts were incorporated into Conceptual data
modeling such as ER modeling.
The result is EER, stands for Extended ER modeling or Enhanced ER modeling.
The additional EER concepts are used to model applications more completely and more
accurately.
EER includes some object-oriented concepts, such as inheritance.
THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
EER model includes all modeling concepts of the ER model
In addition, EER includes:
Subclasses and super classes
Specialization and generalization
Attribute and relationship inheritance
Category or union type
MANAGER
SALARIED_EMPLOYEE, HOURLY_EMPLOYEE
To represent these additional sub groupings, called subclasses or subtypes, Each of these sub
groupings is a subset of EMPLOYEE entities.
EMPLOYEE is the super class for each of these subclasses
These are called super class/subclass relationships:
EMPLOYEE/SECRETARY
EMPLOYEE/TECHNICIAN
EMPLOYEE/MANAGER ...
THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
EER Diagram
THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
Specialization and generalization :
Specialization is the process of defining a set of subclasses of an entity type; this entity type is
called the superclass of the specialization.
The set of subclasses that forms a specialization is defined on the basis of some distinguishing
characteristic of the entities in the superclass.
For Example:
Set of sub classes {SECRETARY, ENGINEER, TECHNICIAN} is a specialization of the
superclass EMPLOYEE .
The subclasses that define a specialization are attached by lines to a circle that represents the
specialization (Subset symbol).
It is a top-down approach in which one higher level entity can be broken down into two lower
level entity.
THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
Specialization and generalization :
THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
Specialization and generalization :
Generalization is a bottom-up approach in which two lower level entities combine to form a
higher level entity.
For Example:
- Consider the entity types CAR and TRUCK have several common attributes, they can be
generalized into the entity type VEHICLE.
- Both CAR and TRUCK are now subclasses of the generalized superclass VEHICLE.
We can view {CAR, TRUCK} as a specialization of VEHICLE, rather than viewing VEHICLE as
a generalization of CAR and TRUCK.
THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
Specialization and generalization :
THE ENHANCED ENTITY-RELATIONSHIP (EER) MODEL
Constraints:
Two basic constraints can apply to a specialization/generalization:
1- Disjointness Constraint
- Specifies that the subclasses of the specialization must be disjoint:
- The entity can be a member of at most one of the subclasses of the specialization.
- Specified by d in EER diagram.
- If not disjoint, specialization is overlapping:
-The entity can be a member of more than one subclass of the specialization.
- Specified by o in EER diagram.
2- Completeness Constraint
- Total specifies that every entity in the super class must be a member of some subclass in the
specialization/generalization.
- Shown in EER diagrams by a double line.