Data
• Data are the raw bits and pieces of information with no context.
• For example 19401, 19402, “MHSSP”, “MSBTE”, a web address, a file etc.
• Data can be quantitative or qualitative.
• Quantitative data is numeric, the result of a measurement, count, or some
other mathematical calculation.
• Qualitative data is descriptive. “Mumbai City”, Nationality.
Database
• Database is a collection of related data organized in a way that data can
be easily accessed, managed and updated.
• It is an organized collection, because in a database, all data is described
and associated with other data.
• All information in a database should be related.
• Separate databases should be created to manage unrelated information.
• Hence, Database is actually a place where related piece of information is
stored and various operations can be performed on it.
• For example: Student Records, Teacher Records, Fees Details
DBMS
• DBMS is software that allows creation, definition and manipulation of
database.
• DBMS is actually a tool used to perform any kind of operation on data in
database.
• DBMS also provides protection and security to database.
• It maintains data consistency in case of multiple users.
• Examples of popular DBMS: MySql, Oracle, SQL Server, Sybase, Microsoft
Access and IBM DB2 etc.
• DBMS contains information about a particular enterprise
1. Collection of interrelated data
2. Set of programs to access the data
• The primary goal of a DBMS is to provide a way to store and retrieve the
database information in convenient and efficient manner.
Advantages of DBMS over File Processing System
• Separation of application program.
• Controlling Redundancy (controlling duplicates data).
• Sharing of data.
• Data integrity.
• Centralized management of data
• Easy retrieval of data.
• Data security.
• Avoiding conflicting requirements
• Reduced development time and maintenance need.
• Performance and efficiency.
• Backup and recovery procedures.
• Concurrency control.
• Data atomicity.
Database Applications
1. Banking Sector: transactions
2. Airlines: reservations, schedules
3. Railway: reservations, schedules
4. Schools: Student Records, Teacher Records, Fees Details
5. Universities / Boards: registration, examination, grades
6. Sales: customers, products, purchases
7. Online retailers: order tracking, customized recommendations
8. Manufacturing: production, inventory, orders, supply chain
9. Human resources: employee records, salaries, tax deductions
10.Hospital: Patient Records, Doctor Records, Medicine Records, Lab test
records
11.Scientific Research
Three level Architecture for Database System
• This is an architecture of a computer network in which many clients (remote
computers) request and receive information from a centralized server.
• Database architecture is logically divided into two types.
1. Two level Architecture OR two-tier Client / Server architecture
2. Three level Architecture OR three-tier Client / Server architecture
Three level Architecture for Database System
• Three level database architecture is commonly used for web applications.
• Intermediate layer called Application server or Web Server stores the web
connectivity software and the logic(constraints).
• This layer acts like medium for sending partially processed data between the
database server and the client.
• It separates its tiers from each other based on the complexity of the users and
their access to database.
• It is the most widely used architecture to design a DBMS.
Data Independence – Logical and Physical
Independence
• The capacity to change the schema at one level without having to change
the schema at the next higher level is known as data independence.
• Data independence occurs because when the schema is changed at some
level, the schema at the next higher level remains unchanged.
• Only the mapping between the levels is changed.
• In general, the interfaces between the various levels and components
should be well defined so that changes in some parts do not seriously
influence others
• Two types of Data Independence:
– Logical Data Independence
– Physical Data Independence
Data Independence – Logical and Physical
Independence
• The ability to change the logical schema without having to
change the external schemas or application programs.
• When data is added or removed, only the view definition
and the mappings need to be changed in the DBMS that
Logical Data support logical data independence.
Independence • Applications depend on the logical schema.
• If the conceptual schema undergoes a logical reorganization,
application programs that reference the external schema
constructs must work as before
• The ability to modify the physical schema without changing
the logical schema.
• Physical file reorganization to improve performance results
in a change to the internal schema. If the same data as
Physical Data before remains in the database, the logical schema should
Independence not change.
• For example, providing an access path to improve retrieval
speed of section records by semester and year should not
require a query to be changed, although it should become
more efficient by utilizing the access path
Data Modelling Concepts
❖ A Database / data model defines the logical design of data.
❖ It describes the data, relationships between different parts of the data,
data semantics and integrity constraints.
❖ A data model is underlying structure of the database.
❖ Relational Model is the most widely used data model.
❖ Three record based logical models are:
• Hierarchical Model
• Network Model
• Relational Model
Hierarchical Model
❖ Hierarchical model was developed in 1960 and organises data into a tree-
like structure.
❖ Its basic logical structure is represented by an upside down tree.
❖ In this model data storage is in the form of parent-child relationship.
❖ In this model each entity has only one parent but can have several
children.
❖ At the top of hierarchy there is only one entity which is called Root.
❖ Entities which follow the root are called the node and the last node in the
tree is called the leaf node.
• This model basically follows the one-to-many relationship. The following
figure represents a hierarchical database.
Hierarchical Model contd..
Hierarchical Model contd..
Advantages:
• Simplicity in logical design
• Security of data
• Data Integrity
• Efficiency
Disadvantages:
• Structural dependence
• Implementation complexity
• Data Access Complexity
• Implementation restrictions
Network Model
❖ Network model was developed at General Electric Company in 1964 and
was standardised by CODASYL IN 1971.
❖ In the network model, entities are organised in a graph, in which some
entities can be accessed through several path.
❖ Represents complex data relationships more effectively.
❖ Data in network model are represented by collection of records of fixed
format
❖ Relationships among data are represented by links which can be viewed as
pointers.
Network Model contd..
❖ In the above figure, boxes area used to represent records and lines are
used to represent links between the records.
❖ It supports many-to-many relationship.
❖ The network model allows each record to have multiple parent and child
records
Network Model contd..
Advantages:
• Logically simple.
• User friendly data access.
• Data integrity.
• Can handle many forms of mapping cardinality.
• Standardized approach.
Disadvantages:
• Complexity of the system.
• Structural dependence.
Relational Model
The properties of
relation(tables)
In this are as follows:
model,
data is In Values are
organised relational atomic.
Relational in two- model,
model was dimension data is Each Each row is
introduced al tables represente column has unique.
by E.F called d in terms a unique
Codd in relations. of tuples name. Column values
are of same
1970. The tables (rows) & type.
or relations attributes
are related (columns). The sequences
of column are
to each not important.
other.
The sequences
of rows are also
not important.
Relational Model contd..
Figure: Relational Model Database
Relational Model contd..
Advantages:
• Data independence
• Simplicity
• Ease of data retrieval
• Less overhead management
• Structural independence
• Group data manipulation
Disadvantages
• Large hardware overheads
• Ease of design can lead to bad design.
Entity Relationship Model
• Entity relationship model defines the conceptual view of database.
• Graphical representation of entities and their relationships in a database
structure
• Introduced by Chen in 1976
• Widely accepted and adapted graphical tool for data modeling.
• At view level, ER model is considered well for designing databases
• Entity relationship diagram (ERD)
– Uses graphic representations to model database components
– Each entity in the ER diagram corresponds to a table in the database.
– The attributes of an entity correspond to fields of a tables
– ER diagram is converted to the database
Strong Entity Set
• An entity set that has a primary key is called as Strong entity set.
• By using a primary key, entities in the table can be uniquely identified.
• In an ER diagram, the strong entity set is represented by the rectangle.
Here, the primary key is underlined with the solid line.
• A member of a strong entity set is called dominant entity
Weak Entity Set
• The entity set which does not have sufficient attributes to form a primary
key is called as Weak entity set.
• But, for discriminating the entities in a set, the weak entity set
is dependent on a particular strong entity set.
• It has to be dependent on identifying entity set i.e. a particular ‘strong
entity set’.
• Double rectangle represents weak entity.
• The relation between a weak entity set and a strong entity set is called
as identifying relationship.
Attributes
• Entities are represented by means of their properties, called attributes.
• In other words, attributes are the properties / characteristics of an entity.
• All attributes have values.
• For example, a student entity may have
– rollno, name, class, age as attributes.
• There exist a domain or range of values that can be assigned to attributes.
• For example, a student's name cannot be a numeric value. It has to be
alphabetic. A student's age cannot be negative, etc.
E R Diagram
ER-Diagram is a visual representation of data that describes how data is
related to each other.
Figure : Symbols used in E-R Diagram(ERD)
Example : E R Diagram
Example : E R Diagram
Relationship
• The association among entities is called relationship.
• For example, employee entity has relation works for department.
• Another example is for student who enrols in some course.
• Here, works and enrols are called relationship.
Relationship Set:
• Relationship of similar type is called relationship set.
• Like entities, a relationship too can have attributes.
• These attributes are called descriptive attributes.
Degree of relationship
• The number of participating entities in a relationship defines the degree of
the relationship.
• Binary Relationship = degree 2
• Ternary Relationship = degree 3
• Recursive Relationship
• n-ary = degree
Relationship
Binary Relationship
• Binary Relationship means relation between two Entities. This is further
divided into Four types.
– One-to-One
– One-to-Many
– Many-to-One
– Many-to-Many
Mapping Cardinalities:
• Cardinality defines the number of entities in one entity set which can be
associated to the number of entities of other set via relationship set.
Relationship
One-to-one: one entity from entity set A can be associated with at most one
entity of entity set B and vice versa.
This type of relationship is rarely seen in real world.
The above example describes that one student can enrol only for one course
and a course will also have only one Student. This is not what you will usually
see in relationship.
Relationship
One-to-many: One entity from entity set A can be associated with more than
one entities of entity set B but from entity set B one entity can be associated
with at most one entity.
Relationship
Many-to-one: More than one entities from entity set A can be associated
with at most one entity of entity set B but one entity from entity set B can be
associated with more than one entity from entity set A.
Relationship
Many-to-many: one entity from A can be associated with more than one
entity from B and vice versa.