Unit 1
Unit 1
By :
Mrs. Suman Madan
[email protected]
Database Management System (DBMS)
Collection of interrelated data
Database Applications:
• Banking: all transactions
• Airlines: reservations, schedules
• Universities: registration, grades
• Sales: customers, products, purchases
• Manufacturing: production, inventory, orders, supply chain
• Human resources: employee records, salaries, tax deductions
• Integrity problems
Integrity constraints (e.g. account balance > 0) become part
of program code
Hard to add new constraints or change existing ones.
Drawbacks of file systems (cont.)
• Atomicity of updates
Failures may leave database in an inconsistent state with
partial updates carried out.
E.g. transfer of funds from one account to another should
either complete or not happen at all.
External
view: User &
Data
Designer
Conceptual
Schema:
Data
Designer
Physical
Storage:
DBA
An architecture for a database system
Views of Data
Physical level/Internal level : The physical
representation of the database on the computer.
This level describes how the data is stored in the
database.
• It includes :
Where the data is located
File structures
Access methods
Indexes.
3. Specialized users: These are also sophisticated users, but they write
special database application programs. They are the developers who
develop the complex programs to the requirement.
Database Users
4. Stand-alone Users - These users will have stand –alone
database for their personal use. These kinds of database will
have readymade database packages which will have menus and
graphical interfaces.
5. Naive users: These are the users who use the existing
application to interact with the database. For example, online
library system, ticket booking systems, ATMs etc which has
existing application and users use them to interact with the
database to fulfill their requests.
Overall System Structure
Facilitate interaction among the designer, the applications programmer, and the
end user
• Manipulative part – defining the types of operations that are allowed on the
data (includes insertion, retrieval or updating)
• ADVANTAGES:
1. Simplicity : Data naturally have hierarchical relationship in most of the practical situations.
Therefore, it is easier to view data arranged in manner. This makes this type of database more
suitable for the purpose.
2. Security :These database system can enforce varying degree of security feature unlike flat-file
system.
3. Database Integrity: Because of its inherent parent-child structure, database integrity is highly
promoted in these systems.
4. Efficiency: The hierarchical database model is a very efficient, one when the database contains a large
number of I: N relationships (one-to-many relationships) and when the users require large number of
transactions, using data whose relationships are fixed.
• DISADVANTAGES:
1. Complexity of Implementation: The actual implementation of a hierarchical database depends on the
physical storage of data. This makes the implementation complicated.
2. Difficulty in Management: The movement of a data segment from one location to another cause all the
accessing programs to be modified making database management a complex affair.
3. Complexity of Programming: Programming a hierarchical database is relatively complex because the
programmers must know the physical path of the data items.
4. Poor Portability: The database is not easily portable mainly because there is little or no standard existing for
these types of database.
5. Database Management Problems: If you make any changes in the database structure of a hierarchical
database, then you need to make the necessary changes in all the application programs that access the
database. Thus, maintaining the database and the applications can become very difficult.
6. Lack of structural independence: Structural independence exists when the changes to the database structure
does not affect the DBMS's ability to access data. Hierarchical database systems use physical storage paths to
navigate to the different data segments. So, the application programs should have a good knowledge of the
relevant access paths to access the data. So, if the physical structure is changed the applications will also have
to be modified. Thus, in a hierarchical database the benefits of data independence are limited by structural
dependence.
7. Programs Complexity: Due to the structural dependence and the navigational structure, the application
programs and the end users must know precisely how the data is distributed physically in the database in
order to access data. This requires knowledge of complex pointer systems, which is often beyond the grasp of
ordinary users (users who have little or no programming knowledge).
8. Operational Anomalies: Hierarchical model suffers from the Insert anomalies, Update anomalies and
Deletion anomalies, also the retrieval operation is complex and asymmetric, thus hierarchical model is not
suitable for all the cases.
9. Implementation Limitation: Many of the common relationships do not conform to the l:N format required by
the hierarchical model. The many-to-many (N:N) relationships, which are more common in real life are very
difficult to implement in a hierarchical model.
Network Model
The network model is a database model conceived as a flexible way of representing objects and their
relationships.
Its distinguishing feature is that the schema, viewed as a graph in which object types are nodes and
relationship types are arcs, is not restricted to being a hierarchy or lattice.
The network model replaces the hierarchical model with a graph thus allowing more general
connections among the nodes. The main difference of the network model from the hierarchical model
is its ability to handle many to many relationships. In other words it allow a record to have more than
one parent.
Network Model
• ADVANTAGES:
1.) Conceptual simplicity-Just like the hierarchical model,the network model is also
conceptually simple and easy to design.
2.) Capability to handle more relationship types-The network model can handle the one to
many and many to many relationships which is real help in modeling the real life situations.
3.) Ease of data access-The data access is easier and flexible than the hierarchical model.
4.) Data integrity- The network model does not allow a member to exist without an owner.
5.) Data independence- The network model is better than the hierarchical model in isolating the
programs from the complex physical storage details.
6.) Database standards
• DISADVANTAGES:
1.) System complexity- All the records are maintained using pointers and hence the whole
database structure becomes very complex.
2.) Operational Anomalies- The insertion, deletion and updating operations of any record
require large number of pointers adjustments.
3.) Absence of structural independence-structural changes to the database is very difficult.
Relational Model
Attributes
Example of tabular data in the relational model
Customer- customer- customer- customer- account-
id name street city number
192-83-7465 Johnson Alma Palo Alto A-101
019-28-3746 Smith North Rye A-215
192-83-7465 Johnson Alma Palo Alto A-201
321-12-3123 Jones Main Harrison A-217
019-28-3746 Smith North Rye A-201
A Sample Relational Database
Schemas and Instances
Instances and schemas are similar to types and variables in
programming languages.
• The schema is specified during the database design process and is not
expected to change frequently.
Schemas and Instances
Instance – the actual content of the database i.e. actual data at a particular
point in time .
• Analogous to the value of a variable.
• The actual data in the database may change very frequently.
The interfaces between the various levels and components should be well
defined so that changes in some parts do not seriously influence others.
Entity
An entity is an object or concept about which you want to store
information.
Key attribute
A key attribute is the unique, distinguishing characteristic of the
entity. For example, an employee's social security number might
be the employee's key attribute.
ER Diagram Symbols
Relationships
Relationships illustrate how two entities share information in the
database structure.
Weak Entity
A weak entity is an entity that must defined by a foreign key
relationship with another entity as it cannot be uniquely identified
by its own attributes alone.
ER Diagram Symbols
Derived attribute
A derived attribute is based on another attribute. For example, an
employee's monthly salary is based on the employee's annual
salary.
Multivalued attribute
A multivalued attribute can have more than one value. For
example, an employee entity can have multiple skill values.
How to express Relationships
Cardinality specifies how many instances of an entity relate to one instance
of another entity.
a
Entity-Relationship Model
MaxSpeed Tonnage
CAR Price TRUCK Price
VehicleID VehicleID
VEHICLE
NoOfPassengers d NoOfAxies
MaxSpeed
CAR TRUCK Tonnage
Generalization (Cont..)
Thanks…….