SlideShare a Scribd company logo
UNIT 1
BCA II SEM
Prepared By: Ms. Sushma Malik
SYLLABUS
 UNIT – I
 Introduction: An overview of database management
system, Characteristics of database approach, DBMS
architecture, client/server, data Models, Introduction to
Distributed Data processing, schema and instances, data
independence,
 Data Modelling using Entity Relationship Model: Basic
introduction about the terminologies like Entity, Entity
types, entity set, notation for ER diagram, attributes and
keys, Types of attributes (composite, derived and
multivalued attributes) and keys (Super Key, candidate key,
primary key), relationships, relation types, weak entities,
enhanced E-R, specialization and generalization.
Prepared By: Ms. Sushma Malik
SYLLABUS
 UNIT – II
 Introduction to SQL: Overview, Characteristics of SQL. Advantage of
SQL, SQL data types and literals.
 Types of SQL commands: DDL, DML, DCL. Basic SQL Queries.
 Logical operators: BETWEEN, IN, AND, OR and NOT
 Null Values: Disallowing Null Values, Comparisons Using Null Values
 Integrity constraints: Primary Key, Not NULL, Unique, Check,
Referential key
 Introduction to Nested Queries, Correlated Nested Queries, Set-
Comparison Operators, Aggregate Operators: The GROUP BY and
HAVING Clauses,
 Joins: Inner joins, Outer Joins, Left outer, Right outer, full outer joins.
 Overview of other SQL Objects: Views , Sequences, Indexes, Triggers
and Stored procedures. .
Prepared By: Ms. Sushma Malik
SYLLABUS
 UNIT - III
 Relational Data Models: Relational model terminology
domains, Attributes, Tuples, Relations, characteristics of
relations, relational constraints domain constraints, key
constraints and constraints on null, relational DB schema.
Codd’s Rules
 Relational algebra: Basic operations selection and projection,
 Set Theoretic operations: Union, Intersection, set difference
and division (Order, Relational calculus: Domain, Tuple, Well
Formed Formula, specification, quantifiers)
 Join operations: Inner, Outer, Left outer, Right outer, and full
outer join
 Data Normalization: Functional dependencies, Armstrong’s
inference rule, & Normalization (Upto BCNF)
Prepared By: Ms. Sushma Malik
SYLLABUS
 UNIT - IV
 Transaction processing : Definition of Transaction,
Desirable ACID properties
 Database recovery and Database Security: System
failure, Backup & recovery Techniques,
Authentication, Authorization.
 Overview of Query by Language, NoSql databases
Prepared By: Ms. Sushma Malik
INTRODUCTION
An overview of database management system
 Database is a collection of related data and data is a
collection of facts and figures that can be processed to
produce information.
 Mostly data represents recordable facts. Data aids in
producing information, which is based on facts. For
example, if we have data about marks obtained by all
students, we can then conclude about toppers and
average marks.
 A database management system stores data in such
a way that it becomes easier to retrieve, manipulate,
and produce information.
Prepared By: Ms. Sushma Malik
INTRODUCTION
 A DBMS is a software that allows creation, definition and
manipulation of database, allowing users to store, process and
analyse data easily. DBMS provides us with an interface or a
tool, to perform various operations like creating database,
storing data in it, updating data, creating tables in the database
and a lot more.
 DBMS also provides protection and security to the databases. It
also maintains data consistency in case of multiple users.
 Here are some examples of popular DBMS used these days:
 MySql
 Oracle
 SQL Server
 IBM DB2
 PostgreSQL
 Amazon SimpleDB (cloud based) etc.
Prepared By: Ms. Sushma Malik
CHARACTERISTICS OF DBMS
A database management system has following characteristics:
 Data stored into Tables: Data is never directly stored into the
database. Data is stored into tables, created inside the
database. DBMS also allows to have relationships between
tables which makes the data more meaningful and connected.
You can easily understand what type of data is stored where by
looking at all the tables created in a database.
 Reduced Redundancy: In the modern world hard drives are
very cheap, but earlier when hard drives were too expensive,
unnecessary repetition of data in database was a big problem.
But DBMS follows Normalisation which divides the data in
such a way that repetition is minimum.
 Data Consistency: On Live data, i.e. data that is being
continuosly updated and added, maintaining the consistency
of data can become a challenge. But DBMS handles it all by
itself.
Prepared By: Ms. Sushma Malik
CHARACTERISTICS OF DBMS
 Support Multiple user and Concurrent Access: DBMS allows
multiple users to work on it(update, insert, delete data) at the
same time and still manages to maintain the data consistency.
 Query Language: DBMS provides users with a simple Query
language, using which data can be easily fetched, inserted,
deleted and updated in a database.
 Security: The DBMS also takes care of the security of data,
protecting the data from un-authorised access. In a typical
DBMS, we can create user accounts with different access
permissions, using which we can easily secure our data by
restricting user access.
 DBMS supports transactions, which allows us to better handle
and manage data integrity in real world applications where
multi-threading is extensively used.
Prepared By: Ms. Sushma Malik
ADVANTAGES OF DBMS
 Segregation of application program.
 Minimal data duplicacy or data redundancy.
 Easy retrieval of data using the Query Language.
 Reduced development time and maintenance need.
 With Cloud Datacenters, we now have Database
Management Systems capable of storing almost
infinite data.
 Seamless integration into the application
programming languages which makes it very easier to
add a database to almost any application or website.
Prepared By: Ms. Sushma Malik
DISADVANTAGES OF DBMS
 It's Complexity
 Except MySQL, which is open source, licensed DBMSs
are generally costly.
 They are large in size.
Prepared By: Ms. Sushma Malik
FILE SYSTEM VS DBMS
Basis DBMS Approach File System Approach
Meaning DBMS is a collection of
data. In DBMS, the user is
not required to write the
procedures.
The file system is a collection of data. In
this system, the user has to write the
procedures for managing the database.
Sharing of data Due to the centralized
approach, data sharing is
easy.
Data is distributed in many files, and it
may be of different formats, so it isn't
easy to share data.
Data
Abstraction
DBMS gives an abstract
view of data that hides the
details.
The file system provides the detail of the
data representation and storage of data.
Security and
Protection
DBMS provides a good
protection mechanism.
It isn't easy to protect a file under the file
system.
Recovery
Mechanism
DBMS provides a crash
recovery mechanism, i.e.,
DBMS protects the user
from system failure.
The file system doesn't have a crash
mechanism, i.e., if the system crashes
while entering some data, then the
content of the file will be lost.
Prepared By: Ms. Sushma Malik
FILE SYSTEM VS DBMS
Manipulation
Techniques
DBMS contains a wide
variety of sophisticated
techniques to store and
retrieve the data.
The file system can't efficiently
store and retrieve the data.
Concurrency
Problems
DBMS takes care of
Concurrent access of data
using some form of locking.
In the File system, concurrent access
has many problems like redirecting
the file while deleting some
information or updating some
information.
Where to use Database approach used in
large systems which interrelate
many files.
File system approach used in large
systems which interrelate many files.
Cost The database system is
expensive to design.
The file system approach is cheaper
to design.
Data
Redundancy
and
Inconsistency
Due to the centralization of the
database, the problems of data
redundancy and inconsistency
are controlled.
In this, the files and application
programs are created by different
programmers so that there exists a lot
of duplication of data which may lead
to inconsistency.
Prepared By: Ms. Sushma Malik
FILE SYSTEM VS DBMS
Structure The database structure is
complex to design.
The file system approach has a
simple structure.
Data
Independence
•In this system, Data
Independence exists, and it can
be of two types.Logical Data
Independence
•Physical Data Independence
In the File system approach, there
exists no Data Independence.
Integrity
Constraints
Integrity Constraints are easy to
apply.
Integrity Constraints are difficult to
implement in file system.
Data Models •In the database approach, 3
types of data models
exist:Hierarchal data models
•Network data models
•Relational data models
In the file system approach, there
is no concept of data models
exists.
Flexibility Changes are often a necessity
to the content of the data stored
in any system, and these
changes are more easily with a
The flexibility of the system is less
as compared to the DBMS
approach.
Prepared By: Ms. Sushma Malik
COMPONENTS OF DBMS
Prepared By: Ms. Sushma Malik
DBMS USERS
 Database Administrators: Database Administrator or DBA
is the one who manages the complete database management
system. DBA takes care of the security of the DBMS, it's
availability, managing the license keys, managing user
accounts and access etc.
 Application Programmer or Software Developer: This
user group is involved in developing and designing the parts
of DBMS.
 End User: These days all the modern applications, web or
mobile, store user data. How do you think they do it? Yes,
applications are programmed in such a way that they collect
user data and store the data on DBMS systems running on
their server. End users are the one who store, retrieve,
update and delete data.
Prepared By: Ms. Sushma Malik
DBMS ARCHITECTURE
 A Database Management system is not always directly
available for users and applications to access and store data
in it.
 A Database Management system can be centralized(all
the data stored at one location), decentralized(multiple
copies of database at different locations) or hierarchical,
depending upon its architecture.
Database Architecture types:
 1-tier DBMS architecture
 2-tier DBMS architecture
 3-tier DBMS architecture
Prepared By: Ms. Sushma Malik
DBMS ARCHITECTURE
 1-tier DBMS architecture also exist, this is when the
database is directly available to the user for using it to
store data.
 Generally such a setup is used for local application
development, where programmers communicate
directly with the database for quick response.
Prepared By: Ms. Sushma Malik
DBMS ARCHITECTURE
 2-tier DBMS architecture includes an Application
layer between the user and the DBMS, which is responsible
to communicate the user's request to the database
management system and then send the response from the
DBMS to the user.
 An application interface known as ODBC(Open Database
Connectivity) provides an API that allow client side program
to call the DBMS. Most DBMS vendors provide ODBC drivers
for their DBMS.
 Such an architecture provides the DBMS extra security as it is
not exposed to the End User directly. Also, security can be
improved by adding security and authentication checks in
the Application layer too.
Prepared By: Ms. Sushma Malik
DBMS ARCHITECTURE
Prepared By: Ms. Sushma Malik
DBMS ARCHITECTURE
 3-tier DBMS architecture is the most commonly used
architecture for web applications.
 It is an extension of the 2-tier architecture. In the 2-tier
architecture, we have an application layer which can be
accessed programmatically to perform various operations
on the DBMS. The application generally understands the
Database Access Language and processes end users
requests to the DBMS.
 In 3-tier architecture, an additional Presentation or GUI
Layer is added, which provides a graphical user interface for
the End user to interact with the DBMS.
 For the end user, the GUI layer is the Database System, and
the end user has no idea about the application layer and
the DBMS system.
Prepared By: Ms. Sushma Malik
DBMS ARCHITECTURE
Prepared By: Ms. Sushma Malik
CLIENT/SERVER
 In client-server architecture many clients connected
with one server. The server is centerlines.it provides
services to all clients. All clients request to the server for
different Service. The server displays the results
according to the client’s request.
 Client/server architecture is a computing model in
which the server hosts (computer), send and manages
most of the resources and works to be required by the
client. In this type of architecture has one or more client
computers attached to a central server over a network.
This system shares different resources.
 Client/server architecture is also called as a networking
computing model and client-server network because all
the requests and demands are sent over a network.
Prepared By: Ms. Sushma Malik
HOW THE CLIENT-SERVER MODEL
WORKS ?
 Client: When we talk the word Client, it mean to talk of a
person or an organization using a particular service.
Similarly in the digital world a Client is a computer
(Host) i.e. capable of receiving information or using a
particular service from the service providers (Servers).
 Servers: Similarly, when we talk the word Servers, It
mean a person or medium that serves something.
Similarly in this digital world a Server is a remote
computer which provides information (data) or access to
particular services.
 So, its basically the Client requesting something and
the Server serving it as long as its present in the database.
Prepared By: Ms. Sushma Malik
CLIENT/SERVER
Prepared By: Ms. Sushma Malik
ADVANTAGES OF CLIENT-SERVER DATABASE
ARCHITECTURE IN DBMS
 All the data and resources are controlled by server .
 You can easily increase the number of client in this
architecture at any time. This all increases the
scalability of the network.
 This is very easy to maintain you can easily repair,
replace or add clients in this network. the
independence of the changes also known as
encapsulation.
 This network is very easy to use and it is not
complicated.
Prepared By: Ms. Sushma Malik
DISADVANTAGES OF CLIENT-SERVER DATABASE
ARCHITECTURE IN DBMS
 Traffic is a big problem in this network.
 When you add large numbers of the client with server this
network will be more complicated.
 When the server goes down all the clients are not able to
send their request. The whole work will be stopped
 The hardware and software are very expensive.
 The client does not have resources for each resource they
need to request the server. Because of all resources exit on
server
Prepared By: Ms. Sushma Malik
DATA MODEL
 Data Model gives us an idea that how the final system will
look like after its complete implementation. It defines the
data elements and the relationships between the data
elements. Data Models are used to show how data is stored,
connected, accessed and updated in the database
management system.
 Some of the Data Models in DBMS are:
 Hierarchical Model
 Network Model
 Entity-Relationship Model
 Relational Model
 Object-Oriented Data Model
Prepared By: Ms. Sushma Malik
HIERARCHICAL MODEL
 The hierarchical model organizes data into a tree-like
structure, where each record has a single parent or
root.
 Sibling records are sorted in a particular order.
 That order is used as the physical order for storing the
database.
 This model is good for describing many real-world
relationships.
Prepared By: Ms. Sushma Malik
HIERARCHICAL MODEL
Prepared By: Ms. Sushma Malik
FEATURES OF A HIERARCHICAL
MODEL
 One-to-many relationship: The data here is organized in a
tree-like structure where the one-to-many relationship is
between the data types. Also, there can be only one path
from parent to any node. Example: In the above example, if
we want to go to the node sneakers we only have one path to
reach there i.e. through men's shoes node.
 Parent-Child Relationship: Each child node has a parent
node but a parent node can have more than one child node.
Multiple parents are not allowed.
 Deletion Problem: If a parent node is deleted then the
child node is automatically deleted.
 Pointers: Pointers are used to link the parent node with the
child node and are used to navigate between the stored data.
Prepared By: Ms. Sushma Malik
HIERARCHICAL MODEL
ADVANTAGES DISADVANTAGES
 It is very simple and fast to
traverse through a tree-like
structure.
 Any change in the parent
node is automatically
reflected in the child node so,
the integrity of data is
maintained.
 Complex relationships are
not supported.
 As it does not support more
than one parent of the child
node so if we have some
complex relationship where a
child node needs to have two
parent node then that can't
be represented using this
model.
 If a parent node is deleted
then the child node is
automatically deleted.
Prepared By: Ms. Sushma Malik
NETWORK MODEL
 The network model builds on the hierarchical
model by allowing many-to-many relationships
between linked records, implying multiple parent
records.
 Based on mathematical set theory, the model is
constructed with sets of related records.
 Each set consists of one owner or parent record
and one or more member or child records.
 A record can be a member or child in multiple sets,
allowing this model to convey complex
relationships.
Prepared By: Ms. Sushma Malik
NETWORK MODEL
Prepared By: Ms. Sushma Malik
FEATURES OF A NETWORK MODEL
 Ability to Merge more Relationships: In this model,
as there are more relationships so data is more related.
This model has the ability to manage one-to-one
relationships as well as many-to-many relationships.
 Many paths: As there are more relationships so there
can be more than one path to the same record. This
makes data access fast and simple.
 Circular Linked List: The operations on the network
model are done with the help of the circular linked list.
The current position is maintained with the help of a
program and this position navigates through the
records according to the relationship.
Prepared By: Ms. Sushma Malik
ADVANTAGES OF NETWORK
MODEL
 The data can be accessed faster as compared to the
hierarchical model. This is because the data is more
related in the network model and there can be more
than one path to reach a particular node. So the data
can be accessed in many ways.
 As there is a parent-child relationship so data integrity
is present. Any change in parent record is reflected in
the child record.
Prepared By: Ms. Sushma Malik
DISADVANTAGES OF NETWORK
MODEL
 As more and more relationships need to be handled
the system might get complex. So, a user must be
having detailed knowledge of the model to work with
the model.
 Any change like updation, deletion, insertion is very
complex.
Prepared By: Ms. Sushma Malik
ENTITY-RELATIONSHIP MODEL
 Entity-Relationship Model or simply ER Model is a
high-level data model diagram.
 In this model, we represent the real-world problem
in the pictorial form to make it easy for the
stakeholders to understand.
 It is also very easy for the developers to
understand the system by just looking at the ER
diagram.
 We use the ER diagram as a visual tool to represent
an ER Model.
Prepared By: Ms. Sushma Malik
COMPONENTS OF ER MODEL
 Entities: Entity is a real-world thing. It can be a
person, place, or even a
concept. Example: Teachers, Students, Course,
Building, Department, etc. are some of the entities
of a School Management System.
 Attributes: An entity contains a real-world
property called attribute. This is the characteristics
of that attribute. Example: The entity teacher has
the property like teacher id, salary, age, etc.
 Relationship: Relationship tells how two
attributes are related. Example: Teacher works for
a department.
Prepared By: Ms. Sushma Malik
ENTITY-RELATIONSHIP MODEL
Prepared By: Ms. Sushma Malik
FEATURES OF ER MODEL
 Graphical Representation for Better
Understanding: It is very easy and simple to
understand so it can be used by the developers to
communicate with the stakeholders.
 ER Diagram: ER diagram is used as a visual tool for
representing the model.
 Database Design: This model helps the database
designers to build the database and is widely used
in database design.
Prepared By: Ms. Sushma Malik
ADVANTAGES OF ER MODEL
 Simple: Conceptually ER Model is very easy to build.
If we know the relationship between the attributes and
the entities we can easily build the ER Diagram for the
model.
 Effective Communication Tool: This model is used
widely by the database designers for communicating
their ideas.
 Easy Conversion to any Model: This model maps
well to the relational model and can be easily
converted relational model by converting the ER
model to the table. This model can also be converted
to any other model like network model, hierarchical
model etc.
Prepared By: Ms. Sushma Malik
DISADVANTAGES OF ER MODEL
 No industry standard for notation: There is no
industry standard for developing an ER model. So one
developer might use notations which are not
understood by other developers.
 Hidden information: Some information might be
lost or hidden in the ER model. As it is a high-level
view so there are chances that some details of
information might be hidden.
Prepared By: Ms. Sushma Malik
RELATIONAL MODEL
 Relational Model is the most widely used model. In
this model, the data is maintained in the form of a
two-dimensional table.
 All the information is stored in the form of row and
columns.
 The basic structure of a relational model is tables. So,
the tables are also called relations in the relational
model.
 Example: In this example, we have an Employee table.
Prepared By: Ms. Sushma Malik
RELATIONAL MODEL
Prepared By: Ms. Sushma Malik
FEATURES OF RELATIONAL MODEL
 Tuples: Each row in the table is called tuple. A row
contains all the information about any instance of the
object. In the above example, each row has all the
information about any specific individual like the first
row has information about John.
 Attribute or field: Attributes are the property which
defines the table or relation. The values of the attribute
should be from the same domain. In the above example,
we have different attributes of the employee like Salary,
Mobile_no, etc.
Prepared By: Ms. Sushma Malik
ADVANTAGES OF RELATIONAL MODEL
 Simple: This model is more simple as compared to
the network and hierarchical model.
 Scalable: This model can be easily scaled as we
can add as many rows and columns we want.
 Structural Independence: We can make changes
in database structure without changing the way to
access the data. When we can make changes to the
database structure without affecting the capability
to DBMS to access the data we can say that
structural independence has been achieved.
Prepared By: Ms. Sushma Malik
DISADVANTAGES OF RELATIONAL MODEL
 Hardware Overheads: For hiding the
complexities and making things easier for the user
this model requires more powerful hardware
computers and data storage devices.
 Bad Design: As the relational model is very easy
to design and use. So the users don't need to know
how the data is stored in order to access it. This
ease of design can lead to the development of a
poor database which would slow down if the
database grows.
Prepared By: Ms. Sushma Malik
OBJECT-ORIENTED DATABASE MODEL
 The real-world problems are more closely
represented through the object-oriented data
model.
 In this model, both the data and relationship are
present in a single structure known as an object.
 In this model, two are more objects are connected
through links. We use this link to relate one object
to other objects.
Prepared By: Ms. Sushma Malik
OBJECT-ORIENTED DATABASE MODEL
Prepared By: Ms. Sushma Malik
WHAT IS DATA PROCESSING?
 Data processing is ingesting massive amounts of data in
the system from several different sources such as IoT
devices, social platforms, satellites, wireless networks,
software logs etc. & running the business logic/algorithms
on it to extract meaningful information from it.
 Running algorithms on the data & extracting information
from it is also known as Data Analytics.
 Data analytics helps businesses use the information
extracted from the raw, unstructured, semi-structured
data in terabytes, petabytes scale to create better products,
understand what their customers want, understand their
usage patterns, & subsequently evolve their service or the
product.
Prepared By: Ms. Sushma Malik
What is Distributed Data Processing? How
Different Is It to Centralized Data Processing?
 Distributed data processing is diverging massive
amount of data to several different nodes running in a
cluster for processing.
 All the nodes execute the task allotted parallelly, they
work in conjunction with each other connected by a
network. The entire set-up is scalable & highly
available.
Prepared By: Ms. Sushma Malik
Prepared By: Ms. Sushma Malik
DATA PROCESSING
 Processing data in a distributed environment helps
accomplish the task in a significantly less amount of time
as opposed to when running on a centralized data
processing system solely due to the reason that here the
task is shared by a number of resources/machines &
executed parallelly instead of being run synchronously
arranged in a queue.
 Since the data is processed in lesser time, it is cost-effective
for businesses & helps them to move fast.
 Running a workload in a distributed environment also
makes it more scalable, elastic & available. There is no
single point of failure. The workload can be scaled both
horizontally & vertically.
 Data is made redundant & replicated across the cluster to
avoid any sort of data loss.
Prepared By: Ms. Sushma Malik
HOW DOES DISTRIBUTED DATA PROCESSING
WORK?
 In a distributed data processing system a massive amount of data flows
through several different sources into the system. This process of data
flow is known as Data ingestion.
 Once the data streams in there are different layers in the system
architecture which break down the entire processing into several
different parts.
 Data Collection & Preparation Layer
 This layer takes care of collecting data from different external sources &
preparing it to be processed by the system.
 When the data streams in it has no standard structure. It is raw,
unstructured or semi-structured in nature.
 It may be a blob of text, audio, video, image format, tax return forms,
insurance forms, medical bills etc.
 The task of the data preparation layer is to convert the data into a
consistent standard format, also to classify it as per the business logic
to be processed by the system.
 The layer is intelligent enough to achieve all this without any sort of
human intervention.
Prepared By: Ms. Sushma Malik
Prepared By: Ms. Sushma Malik
HOW DOES DISTRIBUTED DATA
PROCESSING WORK?
 Data Security Layer
 Moving data is vulnerable to security breaches. The role of the
data security layer is to ensure that the data transit is secure by
watching over it throughout, applying security protocols,
encryption & stuff.
 Data Storage Layer
 Once the data streams in it has to be persisted. There are
different approaches to do this.
 If the analytics is run on streaming data in real-time in-memory
distributed caches are used to store & manage data.
 On the contrary, if the data is being processed in a traditional
way like batch processing distributed databases built for
handling big data are used to store stuff.
Prepared By: Ms. Sushma Malik
How Does Distributed Data Processing
Work?
 Data Processing Layer
 This is the layer contains logic which is the real deal, it is
responsible for processing the data.
 The layer runs business logic on the data to extract
meaningful information from it. Machine learning,
predictive, descriptive, decision modelling are primarily
used for this.
 Data Visualization Layer
 All the information extracted is sent to the data
visualization layer which typically contains browser-based
dashboards which display the information in the form of
graphs, charts & infographics etc.
 Kibana is one good example of a data visualization tool,
pretty popular in the industry.
Prepared By: Ms. Sushma Malik
What Are the Types of Distributed
Data Processing?
 There are primarily two types of it. Batch Processing & Real-time
streaming data processing.
 Batch Processing
 Batch processing is the traditional data processing technique
where chunks of data are streamed in batches & processed. The
processing is either scheduled for a certain time of a day or
happens in regular intervals or is random but not real-time.

 Real-time Streaming Data Processing
 In this type of data processing, data is processed in real-time as it
streams in. Analytics is run on the data to get insights from it.
 A good use case of this is getting insights from sports data. As
the game goes on the data ingested from social media & other
sources is analyzed in real-time to figure the viewers’ sentiments,
players stats, predictions etc.
Prepared By: Ms. Sushma Malik
SCHEMA OF DATABASE
 The overall design of the database is called database schema.
Schema will not be changed frequently. It is the logical
structure of a database. It does not show the data in the
database.
 A database schema is the skeleton structure of the database. It
represents the logical view of the entire database.
 A schema contains schema objects like table, foreign key,
primary key, views, columns, data types, stored procedure,
etc.
 A database schema can be represented by using the visual
diagram. That diagram shows the database objects and
relationship with each other.
 A database schema is designed by the database designers to
help programmers whose software will interact with the
database. The process of database creation is called data
modeling.
Prepared By: Ms. Sushma Malik
TYPES OF SCHEMA
 The different types of schemas are as follows −
 Physical schema − It is a database design at the
physical level. It is hidden below the logical schema and
can be changed easily without affecting the application
programs.
 Logical schema − It is a database design at the logical
level. Programmers construct applications using logical
schema.
 External − It is schema at view level. It is the highest
level of a schema which defines the views for end users.
Prepared By: Ms. Sushma Malik
DATABASE SCHEMA
 Database schema refers to the format and layout of the
database in which the data will be stored. It is the one
thing that remains the same throughout unless
otherwise modified. It defines the structure of what
type of data and how it will be stored.
 Example
 A database schema for a person will have fields for
name, email, phone and address as shown below −
Prepared By: Ms. Sushma Malik
INSTANCE
 Instance or extension or database state is a collection
of information that stored in a database at a particular
moment is called an instance of the database.
 The Database instance refers to the information stored
in the database at a given point of time. Thus, it is a
dynamic value which keeps on changing.
 A database instance for the Person database can be
(User1,emai.com,11345679,addr) So the person
construct will contain their individual entities in the
attributes called as instance. This is shown below −
Prepared By: Ms. Sushma Malik
INSTANCE
Prepared By: Ms. Sushma Malik
SCHEMA VS INSTANCE
Schema Instance
It is the overall description of the
database.
It is the collection of information
stored in a database at a particular
moment.
Schema is same for whole database.
Data in instances can be changed
using addition, deletion, updation.
Does not change Frequently. Changes Frequently.
Defines the basic structure of the
database i.e how the data will be
stored in the database.
It is the set of Information stored at
a particular time.
Prepared By: Ms. Sushma Malik
DATA INDEPENDENCE
 Data independence is the ability to modify the scheme
without affecting the programs and the application to
be rewritten.
 Data is separated from the programs, so that the
changes made to the data will not affect the program
execution and the application.
 There are two levels of data independence based on
three levels of abstraction. These are as follows −
 Physical Data Independence
 Logical Data Independence
Prepared By: Ms. Sushma Malik
PHYSICAL DATA INDEPENDENCE
 Physical Data Independence means changing the physical
level without affecting the logical level or conceptual level.
Using this property, we can change the storage device of the
database without affecting the logical schema.
 The changes in the physical level may include changes
using the following −
 A new storage device like magnetic tape, hard disk, etc.
 A new data structure for storage.
 A different data access method or using an alternative files
organization technique.
 Changing the location of the database.
Prepared By: Ms. Sushma Malik
LOGICAL DATA INDEPENDENCE
 Logical view of data is the user view of the data. It presents
data in the form that can be accessed by the end users.
 Logical data is data about database, that is, it stores
information about how data is managed inside. For
example, a table (relation) stored in the database and all its
constraints, applied on that relation.
 Logical data independence is a kind of mechanism, which
liberalizes itself from actual data stored on the disk. If we
do some changes on table format, it should not change the
data residing on the disk.
 Logical data independence is used to separate the external
level from the conceptual view.
 If we do any changes in the conceptual view of the data,
then the user view of the data would not be affected.
 Logical data independence occurs at the user interface
level.
Prepared By: Ms. Sushma Malik
Prepared By: Ms. Sushma Malik
DATA MODELLING USING ENTITY
RELATIONSHIP MODEL
Entity
 An Entity may be an object with a physical existence –
a particular person, car, house, or employee – or it may
be an object with a conceptual existence – a company,
a job, or a university course.
 An Entity is an object of Entity Type and set of all
entities is called as entity set. e.g.; E1 is an entity
having Entity Type Student and set of all students is
called Entity Set. In ER diagram, Entity Type is
represented as:
Prepared By: Ms. Sushma Malik
Prepared By: Ms. Sushma Malik
TYPES OF ENTITY TYPE
 Strong Entity Type
 Weak Entity Type
 Strong Entity Type: Strong entity are those entity
types which has a key attribute. The primary key helps
in identifying each entity uniquely. It is represented by
a rectangle. In example, Roll_no identifies each
element of the table uniquely and hence, we can say
that STUDENT is a strong entity type.
Prepared By: Ms. Sushma Malik
STRONG ENTITY TYPE
Prepared By: Ms. Sushma Malik
WEAK ENTITY TYPE
 Weak Entity Type: Weak entity type doesn't have a key
attribute.
 Weak entity type can't be identified on its own. It depends
upon some other strong entity for its distinct identity.
 This can be understood with a real-life example. There can
be children only if the parent exits. There can be no
independent existence of children. There can be a room
only if building exits. There can be no independent
existence of a room.
 A weak entity is represented by a double outlined
rectangle.
 The relationship between a weak entity type and strong
entity type is called an identifying relationship and shown
with a double outlined diamond instead of a single
outlined diamond.
Prepared By: Ms. Sushma Malik
WEAK ENTITY TYPE
Prepared By: Ms. Sushma Malik
NOTATION FOR ER DIAGRAM
Prepared By: Ms. Sushma Malik
ATTRIBUTE
 Attributes are the properties which define the entity
type. For example, Roll_No, Name, DOB, Age, Address,
Mobile_No are the attributes which defines entity type
Student. In ER diagram, attribute is represented by an
oval.
 Types of Attributes:
 Key Attribute –
 The attribute which uniquely identifies each entity in
the entity set is called key attribute.For example, Roll_No
will be unique for each student. In ER diagram, key
attribute is represented by an oval with underlying lines.
Prepared By: Ms. Sushma Malik
TYPES OF ATTRIBUTES
 Composite Attribute –
An attribute composed of
many other attribute is
called as composite
attribute. For example,
Address attribute of
student Entity type
consists of Street, City,
State, and Country. In ER
diagram, composite
attribute is represented by
an oval comprising of
ovals.
Prepared By: Ms. Sushma Malik
TYPES OF ATTRIBUTES
 Multivalued Attribute
An attribute consisting more than one value for a given
entity. For example, Phone_No (can be more than one for a
given student). In ER diagram, multivalued attribute is
represented by double oval.
Derived Attribute –
An attribute which can be derived from other attributes of
the entity type is known as derived attribute. e.g.; Age (can be
derived from DOB). In ER diagram, derived attribute is
represented by dashed oval.
Prepared By: Ms. Sushma Malik
KEYS
 Keys are the attributes of the entity, which uniquely
identifies the record of the entity. For example
STUDENT_ID identifies individual students,
passport#, license # etc.
 As we have seen already, there are different types of
keys in the database.
 Super Key is the one or more attributes of the entity,
which uniquely identifies the record in the database.
 Candidate Key is one or more set of keys of the entity.
For a person entity, his SSN, passport#, license# etc
can be a super key.
Prepared By: Ms. Sushma Malik
KEYS
 Primary Key is the candidate key, which will be
used to uniquely identify a record by the query.
Though a person can be identified using his SSN,
passport# or license#, one can choose any one of
them as primary key to uniquely identify a person.
Rest of them will act as a candidate key.
 Foreign Key of the entity attribute in the entity
which is the primary key of the related entity.
Foreign key helps to establish the mapping
between two or more entities.
Prepared By: Ms. Sushma Malik
Prepared By: Ms. Sushma Malik
FOREIGN KEY
Prepared By: Ms. Sushma Malik
RELATIONSHIP
 A relationship defines how two or more entities are
inter-related.
 For example, STUDENT and CLASS entities are related
as ‘Student X studies in a Class Y’.
 Here ‘Studies’ defines the relationship between
Student and Class.
 Similarly, Teacher and Subject are related as ‘Teacher
A teaches Subject B’. Here ‘teaches’ forms the
relationship between both Teacher and Subject.
Prepared By: Ms. Sushma Malik
DEGREES OF RELATIONSHIP
 In a relationship two or more number of entities can
participate.
 The number of entities who are part of a particular
relationship is called degrees of relationship.
 If only two entities participate in the mapping, then
degree of relation is 2 or binary.
 If three entities are involved, then degree of relation is
3 or ternary.
 If more than 3 entities are involved then the degree of
relation is called n-degree or n-nary.
Prepared By: Ms. Sushma Malik
CARDINALITY OF RELATIONSHIP
 How many number of instances of one entity is
mapped to how many number of instances of another
entity is known as cardinality of a relationship.
 In a ‘studies’ relationship above, what we observe is
only one Student X is studying in on Class Y. i.e.; single
instance of entity student mapped to a single instance
of entity Class.
 This means the cardinality between Student and Class
is 1:1.
Prepared By: Ms. Sushma Malik
CARDINALITY OF RELATIONSHIP
 Based on the cardinality, there are 3 types of
relationship.
 One-to-One (1:1): As we saw in above example, one
instance of the entity is mapped to only one instance
of another entity. Consider, HOD of the Department.
There is only one HOD in one department. That is
there is 1:1 relationship between the entity HOD and
Department.
Prepared By: Ms. Sushma Malik
CARDINALITY OF RELATIONSHIP
 One-to-Many (1: M): As we can guess now, one to
many relationship has one instance of entity related to
multiple instances of another entity. One manager
manages multiple employees in his department. Here
Manager and Employee are entities, and the
relationship is one to many. Similarly, one teacher
teaches multiple classes is also a 1: M relationship.
Prepared By: Ms. Sushma Malik
CARDINALITY OF RELATIONSHIP
 Many-to-Many (M: N): This is a relationship where
multiple instances of entities are related to multiple
instances of another entity. A relationship between
TEACHER and STUDENT is many to many. How?
Multiple Teachers teach multiple numbers of
Students.
Prepared By: Ms. Sushma Malik
ENHANCED ENTITY RELATIONSHIP
MODEL (EER MODEL)
 EER is a high-level data model that incorporates the
extensions to the original ER model.
It is a diagrammatic technique for displaying the
following concepts
 Sub Class and Super Class
 Specialization and Generalization
 Union or Category
 Aggregation
 These concepts are used when the comes in EER schema
and the resulting schema diagrams called as EER
Diagrams.
Prepared By: Ms. Sushma Malik
Features of EER Model
 EER creates a design more accurate to database
schemas.
 It reflects the data properties and constraints more
precisely.
 It includes all modeling concepts of the ER model.
 Diagrammatic technique helps for displaying the EER
schema.
 It includes the concept of specialization and
generalization.
 It is used to represent a collection of objects that is
union of objects of different of different entity types.
Prepared By: Ms. Sushma Malik
SUB CLASS AND SUPER CLASS
Sub class and Super class relationship leads the concept of Inheritance.
 The relationship between sub class and super class is denoted with
symbol.
Super Class
 Super class is an entity type that has a relationship with one or more
subtypes.
 An entity cannot exist in database merely by being member of any super
class.
 For example: Shape super class is having sub groups as Square, Circle,
Triangle.
Sub Class
 Sub class is a group of entities with unique attributes.
 Sub class inherits properties and attributes from its super class.
 For example: Square, Circle, Triangle are the sub class of Shape super class.
Prepared By: Ms. Sushma Malik
SUB CLASS AND SUPER CLASS
Prepared By: Ms. Sushma Malik
GENERALIZATION
 Generalization is the process of generalizing the
entities which contain the properties of all the
generalized entities.
 It is a bottom approach, in which two lower level
entities combine to form a higher level entity.
 Generalization is the reverse process of Specialization.
 It defines a general entity type from a set of specialized
entity type.
 It minimizes the difference between the entities by
identifying the common features.
Prepared By: Ms. Sushma Malik
GENERALIZATION
Prepared By: Ms. Sushma Malik
SPECIALIZATION
 Specialization is a process that defines a group
entities which is divided into sub groups based on
their characteristic.
 It is a top down approach, in which one higher
entity can be broken down into two lower level
entity.
 It maximizes the difference between the members
of an entity by identifying the unique
characteristic or attributes of each member.
 It defines one or more sub class for the super class
and also forms the superclass/subclass
relationship.
Prepared By: Ms. Sushma Malik
SPECIALIZATION
Prepared By: Ms. Sushma Malik
 Specialized classes are often called subclass while
a generalized class is called a superclass, probably
inspired by object-oriented programming.
 A sub-class is best understood by “IS-A analysis”.
Following statements hopefully makes some sense to
your mind “Technician IS-A Employee”, “Laptop IS-A
Computer”.
Prepared By: Ms. Sushma Malik
E-R DIAGRAM
 An Entity–relationship model (ER model) describes the
structure of a database with the help of a diagram, which is
known as Entity Relationship Diagram (ER Diagram).
 An ER model is a design or blueprint of a database that can
later be implemented as a database.
 The main components of E-R model are: entity set and
relationship set.
 An ER diagram shows the relationship among entity sets.
An entity set is a group of similar entities and these entities
can have attributes. In terms of DBMS, an entity is a table
or attribute of a table in database, so by showing
relationship among tables and their attributes, ER diagram
shows the complete logical structure of a database.
Prepared By: Ms. Sushma Malik
E-R DIAGRAM
Prepared By: Ms. Sushma Malik
E-R DIAGRAM
 In the following diagram we have two entities Student
and College and their relationship.
 The relationship between Student and College is many
to one as a college can have many students however a
student cannot study in multiple colleges at the same
time.
 Student entity has attributes such as Stu_Id,
Stu_Name & Stu_Addr and College entity has
attributes such as Col_ID & Col_Name.
Prepared By: Ms. Sushma Malik
COMPONENTS OF A ER DIAGRAM
Prepared By: Ms. Sushma Malik
REDUCTION OF ER DIAGRAM TO TABLE
 The database can be represented using the notations,
and these notations can be reduced to a collection of
tables.
 In the database, every entity set or relationship set can
be represented in tabular form.
Prepared By: Ms. Sushma Malik
REDUCTION OF ER DIAGRAM TO TABLE
Prepared By: Ms. Sushma Malik
REDUCTION OF ER DIAGRAM TO TABLE
 There are some points for converting the ER diagram to the
table:
 Entity type becomes a table.
 In the given ER diagram, LECTURE, STUDENT, SUBJECT and
COURSE forms individual tables.
 All single-valued attribute becomes a column for the table.
 In the STUDENT entity, STUDENT_NAME and STUDENT_ID
form the column of STUDENT table. Similarly, COURSE_NAME
and COURSE_ID form the column of COURSE table and so on.
 A key attribute of the entity type represented by the
primary key.
 In the given ER diagram, COURSE_ID, STUDENT_ID,
SUBJECT_ID, and LECTURE_ID are the key attribute of the
entity.
Prepared By: Ms. Sushma Malik
REDUCTION OF ER DIAGRAM TO TABLE
 The multivalued attribute is represented by a
separate table.
 In the student table, a hobby is a multivalued
attribute. So it is not possible to represent multiple
values in a single column of STUDENT table. Hence
we create a table STUD_HOBBY with column name
STUDENT_ID and HOBBY. Using both the column,
we create a composite key.
 Composite attribute represented by components.
 In the given ER diagram, student address is a
composite attribute. It contains CITY, PIN, DOOR#,
STREET, and STATE. In the STUDENT table, these
attributes can merge as an individual column.
Prepared By: Ms. Sushma Malik
REDUCTION OF ER DIAGRAM TO TABLE
 Derived attributes are not considered in the table.
 In the STUDENT table, Age is the derived attribute. It
can be calculated at any point of time by calculating
the difference between current date and Date of Birth.
 Using these rules, you can convert the ER diagram to
tables and columns and assign the mapping between
the tables. Table structure for the given ER diagram is
as below:
Prepared By: Ms. Sushma Malik
REDUCTION OF ER DIAGRAM TO TABLE
Prepared By: Ms. Sushma Malik

More Related Content

PPTX
Lecture 1-Introduction to Database Management Systems.pptx
PPTX
DBMS. ................................................
PPTX
database management.............................................................
PPTX
Presentation AICT Improved version[1].pptx
PDF
PPTX
Basic of Database Management System(DBMS)
PDF
1677091759369776.pdf
PPT
Database and Database Management (DBM): Health Informatics
Lecture 1-Introduction to Database Management Systems.pptx
DBMS. ................................................
database management.............................................................
Presentation AICT Improved version[1].pptx
Basic of Database Management System(DBMS)
1677091759369776.pdf
Database and Database Management (DBM): Health Informatics

Similar to UNIT 1. Database management system notes (20)

PPTX
database management system anna universityUnit1.pptx
DOCX
ansh24.docxdegevfeghvehydfyebgdfhbgdfhbgefhf
PPTX
DBMS characteristics in Information Management System.pptx
PDF
Dbms quick guide
DOCX
mayank file tt 6 (1).do989loioli9lo9ioocx
DOCX
mayank duehduiehdfeudfheufdhufujfufujdfujdfhuhdfuijdhuidfhuef
PPTX
Database Management System.pptx
PDF
03-database-management-system-revision-notes.pdf
PPT
Basics of Database Management System: Key Components
DOCX
Database Management System.docx
PDF
database management system notes for b com students
PPSX
DBMS_(MySql).ppsx database sql file my sql codes
DOCX
mayankszwshqwehydgfrgyhsdehybedfbedjednhedrik
PDF
ppt_rdbms.pdfuvuguvuvugycycyctcucuvyvvuvuvy
PPT
Database Management system
PPTX
Unit 1.pptx
PPT
Dbms models
PPTX
DEE 431 Introduction to DBMS Slide 1
DOCX
Database management system
DOCX
Database Management System Unit 1 Full Chapter.docx
database management system anna universityUnit1.pptx
ansh24.docxdegevfeghvehydfyebgdfhbgdfhbgefhf
DBMS characteristics in Information Management System.pptx
Dbms quick guide
mayank file tt 6 (1).do989loioli9lo9ioocx
mayank duehduiehdfeudfheufdhufujfufujdfujdfhuhdfuijdhuidfhuef
Database Management System.pptx
03-database-management-system-revision-notes.pdf
Basics of Database Management System: Key Components
Database Management System.docx
database management system notes for b com students
DBMS_(MySql).ppsx database sql file my sql codes
mayankszwshqwehydgfrgyhsdehybedfbedjednhedrik
ppt_rdbms.pdfuvuguvuvugycycyctcucuvyvvuvuvy
Database Management system
Unit 1.pptx
Dbms models
DEE 431 Introduction to DBMS Slide 1
Database management system
Database Management System Unit 1 Full Chapter.docx
Ad

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Machine learning based COVID-19 study performance prediction
PDF
Approach and Philosophy of On baking technology
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
KodekX | Application Modernization Development
Chapter 3 Spatial Domain Image Processing.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
NewMind AI Weekly Chronicles - August'25 Week I
Understanding_Digital_Forensics_Presentation.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
Spectroscopy.pptx food analysis technology
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Advanced methodologies resolving dimensionality complications for autism neur...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MYSQL Presentation for SQL database connectivity
KodekX | Application Modernization Development
Ad

UNIT 1. Database management system notes

  • 1. UNIT 1 BCA II SEM Prepared By: Ms. Sushma Malik
  • 2. SYLLABUS  UNIT – I  Introduction: An overview of database management system, Characteristics of database approach, DBMS architecture, client/server, data Models, Introduction to Distributed Data processing, schema and instances, data independence,  Data Modelling using Entity Relationship Model: Basic introduction about the terminologies like Entity, Entity types, entity set, notation for ER diagram, attributes and keys, Types of attributes (composite, derived and multivalued attributes) and keys (Super Key, candidate key, primary key), relationships, relation types, weak entities, enhanced E-R, specialization and generalization. Prepared By: Ms. Sushma Malik
  • 3. SYLLABUS  UNIT – II  Introduction to SQL: Overview, Characteristics of SQL. Advantage of SQL, SQL data types and literals.  Types of SQL commands: DDL, DML, DCL. Basic SQL Queries.  Logical operators: BETWEEN, IN, AND, OR and NOT  Null Values: Disallowing Null Values, Comparisons Using Null Values  Integrity constraints: Primary Key, Not NULL, Unique, Check, Referential key  Introduction to Nested Queries, Correlated Nested Queries, Set- Comparison Operators, Aggregate Operators: The GROUP BY and HAVING Clauses,  Joins: Inner joins, Outer Joins, Left outer, Right outer, full outer joins.  Overview of other SQL Objects: Views , Sequences, Indexes, Triggers and Stored procedures. . Prepared By: Ms. Sushma Malik
  • 4. SYLLABUS  UNIT - III  Relational Data Models: Relational model terminology domains, Attributes, Tuples, Relations, characteristics of relations, relational constraints domain constraints, key constraints and constraints on null, relational DB schema. Codd’s Rules  Relational algebra: Basic operations selection and projection,  Set Theoretic operations: Union, Intersection, set difference and division (Order, Relational calculus: Domain, Tuple, Well Formed Formula, specification, quantifiers)  Join operations: Inner, Outer, Left outer, Right outer, and full outer join  Data Normalization: Functional dependencies, Armstrong’s inference rule, & Normalization (Upto BCNF) Prepared By: Ms. Sushma Malik
  • 5. SYLLABUS  UNIT - IV  Transaction processing : Definition of Transaction, Desirable ACID properties  Database recovery and Database Security: System failure, Backup & recovery Techniques, Authentication, Authorization.  Overview of Query by Language, NoSql databases Prepared By: Ms. Sushma Malik
  • 6. INTRODUCTION An overview of database management system  Database is a collection of related data and data is a collection of facts and figures that can be processed to produce information.  Mostly data represents recordable facts. Data aids in producing information, which is based on facts. For example, if we have data about marks obtained by all students, we can then conclude about toppers and average marks.  A database management system stores data in such a way that it becomes easier to retrieve, manipulate, and produce information. Prepared By: Ms. Sushma Malik
  • 7. INTRODUCTION  A DBMS is a software that allows creation, definition and manipulation of database, allowing users to store, process and analyse data easily. DBMS provides us with an interface or a tool, to perform various operations like creating database, storing data in it, updating data, creating tables in the database and a lot more.  DBMS also provides protection and security to the databases. It also maintains data consistency in case of multiple users.  Here are some examples of popular DBMS used these days:  MySql  Oracle  SQL Server  IBM DB2  PostgreSQL  Amazon SimpleDB (cloud based) etc. Prepared By: Ms. Sushma Malik
  • 8. CHARACTERISTICS OF DBMS A database management system has following characteristics:  Data stored into Tables: Data is never directly stored into the database. Data is stored into tables, created inside the database. DBMS also allows to have relationships between tables which makes the data more meaningful and connected. You can easily understand what type of data is stored where by looking at all the tables created in a database.  Reduced Redundancy: In the modern world hard drives are very cheap, but earlier when hard drives were too expensive, unnecessary repetition of data in database was a big problem. But DBMS follows Normalisation which divides the data in such a way that repetition is minimum.  Data Consistency: On Live data, i.e. data that is being continuosly updated and added, maintaining the consistency of data can become a challenge. But DBMS handles it all by itself. Prepared By: Ms. Sushma Malik
  • 9. CHARACTERISTICS OF DBMS  Support Multiple user and Concurrent Access: DBMS allows multiple users to work on it(update, insert, delete data) at the same time and still manages to maintain the data consistency.  Query Language: DBMS provides users with a simple Query language, using which data can be easily fetched, inserted, deleted and updated in a database.  Security: The DBMS also takes care of the security of data, protecting the data from un-authorised access. In a typical DBMS, we can create user accounts with different access permissions, using which we can easily secure our data by restricting user access.  DBMS supports transactions, which allows us to better handle and manage data integrity in real world applications where multi-threading is extensively used. Prepared By: Ms. Sushma Malik
  • 10. ADVANTAGES OF DBMS  Segregation of application program.  Minimal data duplicacy or data redundancy.  Easy retrieval of data using the Query Language.  Reduced development time and maintenance need.  With Cloud Datacenters, we now have Database Management Systems capable of storing almost infinite data.  Seamless integration into the application programming languages which makes it very easier to add a database to almost any application or website. Prepared By: Ms. Sushma Malik
  • 11. DISADVANTAGES OF DBMS  It's Complexity  Except MySQL, which is open source, licensed DBMSs are generally costly.  They are large in size. Prepared By: Ms. Sushma Malik
  • 12. FILE SYSTEM VS DBMS Basis DBMS Approach File System Approach Meaning DBMS is a collection of data. In DBMS, the user is not required to write the procedures. The file system is a collection of data. In this system, the user has to write the procedures for managing the database. Sharing of data Due to the centralized approach, data sharing is easy. Data is distributed in many files, and it may be of different formats, so it isn't easy to share data. Data Abstraction DBMS gives an abstract view of data that hides the details. The file system provides the detail of the data representation and storage of data. Security and Protection DBMS provides a good protection mechanism. It isn't easy to protect a file under the file system. Recovery Mechanism DBMS provides a crash recovery mechanism, i.e., DBMS protects the user from system failure. The file system doesn't have a crash mechanism, i.e., if the system crashes while entering some data, then the content of the file will be lost. Prepared By: Ms. Sushma Malik
  • 13. FILE SYSTEM VS DBMS Manipulation Techniques DBMS contains a wide variety of sophisticated techniques to store and retrieve the data. The file system can't efficiently store and retrieve the data. Concurrency Problems DBMS takes care of Concurrent access of data using some form of locking. In the File system, concurrent access has many problems like redirecting the file while deleting some information or updating some information. Where to use Database approach used in large systems which interrelate many files. File system approach used in large systems which interrelate many files. Cost The database system is expensive to design. The file system approach is cheaper to design. Data Redundancy and Inconsistency Due to the centralization of the database, the problems of data redundancy and inconsistency are controlled. In this, the files and application programs are created by different programmers so that there exists a lot of duplication of data which may lead to inconsistency. Prepared By: Ms. Sushma Malik
  • 14. FILE SYSTEM VS DBMS Structure The database structure is complex to design. The file system approach has a simple structure. Data Independence •In this system, Data Independence exists, and it can be of two types.Logical Data Independence •Physical Data Independence In the File system approach, there exists no Data Independence. Integrity Constraints Integrity Constraints are easy to apply. Integrity Constraints are difficult to implement in file system. Data Models •In the database approach, 3 types of data models exist:Hierarchal data models •Network data models •Relational data models In the file system approach, there is no concept of data models exists. Flexibility Changes are often a necessity to the content of the data stored in any system, and these changes are more easily with a The flexibility of the system is less as compared to the DBMS approach. Prepared By: Ms. Sushma Malik
  • 15. COMPONENTS OF DBMS Prepared By: Ms. Sushma Malik
  • 16. DBMS USERS  Database Administrators: Database Administrator or DBA is the one who manages the complete database management system. DBA takes care of the security of the DBMS, it's availability, managing the license keys, managing user accounts and access etc.  Application Programmer or Software Developer: This user group is involved in developing and designing the parts of DBMS.  End User: These days all the modern applications, web or mobile, store user data. How do you think they do it? Yes, applications are programmed in such a way that they collect user data and store the data on DBMS systems running on their server. End users are the one who store, retrieve, update and delete data. Prepared By: Ms. Sushma Malik
  • 17. DBMS ARCHITECTURE  A Database Management system is not always directly available for users and applications to access and store data in it.  A Database Management system can be centralized(all the data stored at one location), decentralized(multiple copies of database at different locations) or hierarchical, depending upon its architecture. Database Architecture types:  1-tier DBMS architecture  2-tier DBMS architecture  3-tier DBMS architecture Prepared By: Ms. Sushma Malik
  • 18. DBMS ARCHITECTURE  1-tier DBMS architecture also exist, this is when the database is directly available to the user for using it to store data.  Generally such a setup is used for local application development, where programmers communicate directly with the database for quick response. Prepared By: Ms. Sushma Malik
  • 19. DBMS ARCHITECTURE  2-tier DBMS architecture includes an Application layer between the user and the DBMS, which is responsible to communicate the user's request to the database management system and then send the response from the DBMS to the user.  An application interface known as ODBC(Open Database Connectivity) provides an API that allow client side program to call the DBMS. Most DBMS vendors provide ODBC drivers for their DBMS.  Such an architecture provides the DBMS extra security as it is not exposed to the End User directly. Also, security can be improved by adding security and authentication checks in the Application layer too. Prepared By: Ms. Sushma Malik
  • 20. DBMS ARCHITECTURE Prepared By: Ms. Sushma Malik
  • 21. DBMS ARCHITECTURE  3-tier DBMS architecture is the most commonly used architecture for web applications.  It is an extension of the 2-tier architecture. In the 2-tier architecture, we have an application layer which can be accessed programmatically to perform various operations on the DBMS. The application generally understands the Database Access Language and processes end users requests to the DBMS.  In 3-tier architecture, an additional Presentation or GUI Layer is added, which provides a graphical user interface for the End user to interact with the DBMS.  For the end user, the GUI layer is the Database System, and the end user has no idea about the application layer and the DBMS system. Prepared By: Ms. Sushma Malik
  • 22. DBMS ARCHITECTURE Prepared By: Ms. Sushma Malik
  • 23. CLIENT/SERVER  In client-server architecture many clients connected with one server. The server is centerlines.it provides services to all clients. All clients request to the server for different Service. The server displays the results according to the client’s request.  Client/server architecture is a computing model in which the server hosts (computer), send and manages most of the resources and works to be required by the client. In this type of architecture has one or more client computers attached to a central server over a network. This system shares different resources.  Client/server architecture is also called as a networking computing model and client-server network because all the requests and demands are sent over a network. Prepared By: Ms. Sushma Malik
  • 24. HOW THE CLIENT-SERVER MODEL WORKS ?  Client: When we talk the word Client, it mean to talk of a person or an organization using a particular service. Similarly in the digital world a Client is a computer (Host) i.e. capable of receiving information or using a particular service from the service providers (Servers).  Servers: Similarly, when we talk the word Servers, It mean a person or medium that serves something. Similarly in this digital world a Server is a remote computer which provides information (data) or access to particular services.  So, its basically the Client requesting something and the Server serving it as long as its present in the database. Prepared By: Ms. Sushma Malik
  • 26. ADVANTAGES OF CLIENT-SERVER DATABASE ARCHITECTURE IN DBMS  All the data and resources are controlled by server .  You can easily increase the number of client in this architecture at any time. This all increases the scalability of the network.  This is very easy to maintain you can easily repair, replace or add clients in this network. the independence of the changes also known as encapsulation.  This network is very easy to use and it is not complicated. Prepared By: Ms. Sushma Malik
  • 27. DISADVANTAGES OF CLIENT-SERVER DATABASE ARCHITECTURE IN DBMS  Traffic is a big problem in this network.  When you add large numbers of the client with server this network will be more complicated.  When the server goes down all the clients are not able to send their request. The whole work will be stopped  The hardware and software are very expensive.  The client does not have resources for each resource they need to request the server. Because of all resources exit on server Prepared By: Ms. Sushma Malik
  • 28. DATA MODEL  Data Model gives us an idea that how the final system will look like after its complete implementation. It defines the data elements and the relationships between the data elements. Data Models are used to show how data is stored, connected, accessed and updated in the database management system.  Some of the Data Models in DBMS are:  Hierarchical Model  Network Model  Entity-Relationship Model  Relational Model  Object-Oriented Data Model Prepared By: Ms. Sushma Malik
  • 29. HIERARCHICAL MODEL  The hierarchical model organizes data into a tree-like structure, where each record has a single parent or root.  Sibling records are sorted in a particular order.  That order is used as the physical order for storing the database.  This model is good for describing many real-world relationships. Prepared By: Ms. Sushma Malik
  • 31. FEATURES OF A HIERARCHICAL MODEL  One-to-many relationship: The data here is organized in a tree-like structure where the one-to-many relationship is between the data types. Also, there can be only one path from parent to any node. Example: In the above example, if we want to go to the node sneakers we only have one path to reach there i.e. through men's shoes node.  Parent-Child Relationship: Each child node has a parent node but a parent node can have more than one child node. Multiple parents are not allowed.  Deletion Problem: If a parent node is deleted then the child node is automatically deleted.  Pointers: Pointers are used to link the parent node with the child node and are used to navigate between the stored data. Prepared By: Ms. Sushma Malik
  • 32. HIERARCHICAL MODEL ADVANTAGES DISADVANTAGES  It is very simple and fast to traverse through a tree-like structure.  Any change in the parent node is automatically reflected in the child node so, the integrity of data is maintained.  Complex relationships are not supported.  As it does not support more than one parent of the child node so if we have some complex relationship where a child node needs to have two parent node then that can't be represented using this model.  If a parent node is deleted then the child node is automatically deleted. Prepared By: Ms. Sushma Malik
  • 33. NETWORK MODEL  The network model builds on the hierarchical model by allowing many-to-many relationships between linked records, implying multiple parent records.  Based on mathematical set theory, the model is constructed with sets of related records.  Each set consists of one owner or parent record and one or more member or child records.  A record can be a member or child in multiple sets, allowing this model to convey complex relationships. Prepared By: Ms. Sushma Malik
  • 34. NETWORK MODEL Prepared By: Ms. Sushma Malik
  • 35. FEATURES OF A NETWORK MODEL  Ability to Merge more Relationships: In this model, as there are more relationships so data is more related. This model has the ability to manage one-to-one relationships as well as many-to-many relationships.  Many paths: As there are more relationships so there can be more than one path to the same record. This makes data access fast and simple.  Circular Linked List: The operations on the network model are done with the help of the circular linked list. The current position is maintained with the help of a program and this position navigates through the records according to the relationship. Prepared By: Ms. Sushma Malik
  • 36. ADVANTAGES OF NETWORK MODEL  The data can be accessed faster as compared to the hierarchical model. This is because the data is more related in the network model and there can be more than one path to reach a particular node. So the data can be accessed in many ways.  As there is a parent-child relationship so data integrity is present. Any change in parent record is reflected in the child record. Prepared By: Ms. Sushma Malik
  • 37. DISADVANTAGES OF NETWORK MODEL  As more and more relationships need to be handled the system might get complex. So, a user must be having detailed knowledge of the model to work with the model.  Any change like updation, deletion, insertion is very complex. Prepared By: Ms. Sushma Malik
  • 38. ENTITY-RELATIONSHIP MODEL  Entity-Relationship Model or simply ER Model is a high-level data model diagram.  In this model, we represent the real-world problem in the pictorial form to make it easy for the stakeholders to understand.  It is also very easy for the developers to understand the system by just looking at the ER diagram.  We use the ER diagram as a visual tool to represent an ER Model. Prepared By: Ms. Sushma Malik
  • 39. COMPONENTS OF ER MODEL  Entities: Entity is a real-world thing. It can be a person, place, or even a concept. Example: Teachers, Students, Course, Building, Department, etc. are some of the entities of a School Management System.  Attributes: An entity contains a real-world property called attribute. This is the characteristics of that attribute. Example: The entity teacher has the property like teacher id, salary, age, etc.  Relationship: Relationship tells how two attributes are related. Example: Teacher works for a department. Prepared By: Ms. Sushma Malik
  • 41. FEATURES OF ER MODEL  Graphical Representation for Better Understanding: It is very easy and simple to understand so it can be used by the developers to communicate with the stakeholders.  ER Diagram: ER diagram is used as a visual tool for representing the model.  Database Design: This model helps the database designers to build the database and is widely used in database design. Prepared By: Ms. Sushma Malik
  • 42. ADVANTAGES OF ER MODEL  Simple: Conceptually ER Model is very easy to build. If we know the relationship between the attributes and the entities we can easily build the ER Diagram for the model.  Effective Communication Tool: This model is used widely by the database designers for communicating their ideas.  Easy Conversion to any Model: This model maps well to the relational model and can be easily converted relational model by converting the ER model to the table. This model can also be converted to any other model like network model, hierarchical model etc. Prepared By: Ms. Sushma Malik
  • 43. DISADVANTAGES OF ER MODEL  No industry standard for notation: There is no industry standard for developing an ER model. So one developer might use notations which are not understood by other developers.  Hidden information: Some information might be lost or hidden in the ER model. As it is a high-level view so there are chances that some details of information might be hidden. Prepared By: Ms. Sushma Malik
  • 44. RELATIONAL MODEL  Relational Model is the most widely used model. In this model, the data is maintained in the form of a two-dimensional table.  All the information is stored in the form of row and columns.  The basic structure of a relational model is tables. So, the tables are also called relations in the relational model.  Example: In this example, we have an Employee table. Prepared By: Ms. Sushma Malik
  • 45. RELATIONAL MODEL Prepared By: Ms. Sushma Malik
  • 46. FEATURES OF RELATIONAL MODEL  Tuples: Each row in the table is called tuple. A row contains all the information about any instance of the object. In the above example, each row has all the information about any specific individual like the first row has information about John.  Attribute or field: Attributes are the property which defines the table or relation. The values of the attribute should be from the same domain. In the above example, we have different attributes of the employee like Salary, Mobile_no, etc. Prepared By: Ms. Sushma Malik
  • 47. ADVANTAGES OF RELATIONAL MODEL  Simple: This model is more simple as compared to the network and hierarchical model.  Scalable: This model can be easily scaled as we can add as many rows and columns we want.  Structural Independence: We can make changes in database structure without changing the way to access the data. When we can make changes to the database structure without affecting the capability to DBMS to access the data we can say that structural independence has been achieved. Prepared By: Ms. Sushma Malik
  • 48. DISADVANTAGES OF RELATIONAL MODEL  Hardware Overheads: For hiding the complexities and making things easier for the user this model requires more powerful hardware computers and data storage devices.  Bad Design: As the relational model is very easy to design and use. So the users don't need to know how the data is stored in order to access it. This ease of design can lead to the development of a poor database which would slow down if the database grows. Prepared By: Ms. Sushma Malik
  • 49. OBJECT-ORIENTED DATABASE MODEL  The real-world problems are more closely represented through the object-oriented data model.  In this model, both the data and relationship are present in a single structure known as an object.  In this model, two are more objects are connected through links. We use this link to relate one object to other objects. Prepared By: Ms. Sushma Malik
  • 51. WHAT IS DATA PROCESSING?  Data processing is ingesting massive amounts of data in the system from several different sources such as IoT devices, social platforms, satellites, wireless networks, software logs etc. & running the business logic/algorithms on it to extract meaningful information from it.  Running algorithms on the data & extracting information from it is also known as Data Analytics.  Data analytics helps businesses use the information extracted from the raw, unstructured, semi-structured data in terabytes, petabytes scale to create better products, understand what their customers want, understand their usage patterns, & subsequently evolve their service or the product. Prepared By: Ms. Sushma Malik
  • 52. What is Distributed Data Processing? How Different Is It to Centralized Data Processing?  Distributed data processing is diverging massive amount of data to several different nodes running in a cluster for processing.  All the nodes execute the task allotted parallelly, they work in conjunction with each other connected by a network. The entire set-up is scalable & highly available. Prepared By: Ms. Sushma Malik
  • 53. Prepared By: Ms. Sushma Malik
  • 54. DATA PROCESSING  Processing data in a distributed environment helps accomplish the task in a significantly less amount of time as opposed to when running on a centralized data processing system solely due to the reason that here the task is shared by a number of resources/machines & executed parallelly instead of being run synchronously arranged in a queue.  Since the data is processed in lesser time, it is cost-effective for businesses & helps them to move fast.  Running a workload in a distributed environment also makes it more scalable, elastic & available. There is no single point of failure. The workload can be scaled both horizontally & vertically.  Data is made redundant & replicated across the cluster to avoid any sort of data loss. Prepared By: Ms. Sushma Malik
  • 55. HOW DOES DISTRIBUTED DATA PROCESSING WORK?  In a distributed data processing system a massive amount of data flows through several different sources into the system. This process of data flow is known as Data ingestion.  Once the data streams in there are different layers in the system architecture which break down the entire processing into several different parts.  Data Collection & Preparation Layer  This layer takes care of collecting data from different external sources & preparing it to be processed by the system.  When the data streams in it has no standard structure. It is raw, unstructured or semi-structured in nature.  It may be a blob of text, audio, video, image format, tax return forms, insurance forms, medical bills etc.  The task of the data preparation layer is to convert the data into a consistent standard format, also to classify it as per the business logic to be processed by the system.  The layer is intelligent enough to achieve all this without any sort of human intervention. Prepared By: Ms. Sushma Malik
  • 56. Prepared By: Ms. Sushma Malik
  • 57. HOW DOES DISTRIBUTED DATA PROCESSING WORK?  Data Security Layer  Moving data is vulnerable to security breaches. The role of the data security layer is to ensure that the data transit is secure by watching over it throughout, applying security protocols, encryption & stuff.  Data Storage Layer  Once the data streams in it has to be persisted. There are different approaches to do this.  If the analytics is run on streaming data in real-time in-memory distributed caches are used to store & manage data.  On the contrary, if the data is being processed in a traditional way like batch processing distributed databases built for handling big data are used to store stuff. Prepared By: Ms. Sushma Malik
  • 58. How Does Distributed Data Processing Work?  Data Processing Layer  This is the layer contains logic which is the real deal, it is responsible for processing the data.  The layer runs business logic on the data to extract meaningful information from it. Machine learning, predictive, descriptive, decision modelling are primarily used for this.  Data Visualization Layer  All the information extracted is sent to the data visualization layer which typically contains browser-based dashboards which display the information in the form of graphs, charts & infographics etc.  Kibana is one good example of a data visualization tool, pretty popular in the industry. Prepared By: Ms. Sushma Malik
  • 59. What Are the Types of Distributed Data Processing?  There are primarily two types of it. Batch Processing & Real-time streaming data processing.  Batch Processing  Batch processing is the traditional data processing technique where chunks of data are streamed in batches & processed. The processing is either scheduled for a certain time of a day or happens in regular intervals or is random but not real-time.   Real-time Streaming Data Processing  In this type of data processing, data is processed in real-time as it streams in. Analytics is run on the data to get insights from it.  A good use case of this is getting insights from sports data. As the game goes on the data ingested from social media & other sources is analyzed in real-time to figure the viewers’ sentiments, players stats, predictions etc. Prepared By: Ms. Sushma Malik
  • 60. SCHEMA OF DATABASE  The overall design of the database is called database schema. Schema will not be changed frequently. It is the logical structure of a database. It does not show the data in the database.  A database schema is the skeleton structure of the database. It represents the logical view of the entire database.  A schema contains schema objects like table, foreign key, primary key, views, columns, data types, stored procedure, etc.  A database schema can be represented by using the visual diagram. That diagram shows the database objects and relationship with each other.  A database schema is designed by the database designers to help programmers whose software will interact with the database. The process of database creation is called data modeling. Prepared By: Ms. Sushma Malik
  • 61. TYPES OF SCHEMA  The different types of schemas are as follows −  Physical schema − It is a database design at the physical level. It is hidden below the logical schema and can be changed easily without affecting the application programs.  Logical schema − It is a database design at the logical level. Programmers construct applications using logical schema.  External − It is schema at view level. It is the highest level of a schema which defines the views for end users. Prepared By: Ms. Sushma Malik
  • 62. DATABASE SCHEMA  Database schema refers to the format and layout of the database in which the data will be stored. It is the one thing that remains the same throughout unless otherwise modified. It defines the structure of what type of data and how it will be stored.  Example  A database schema for a person will have fields for name, email, phone and address as shown below − Prepared By: Ms. Sushma Malik
  • 63. INSTANCE  Instance or extension or database state is a collection of information that stored in a database at a particular moment is called an instance of the database.  The Database instance refers to the information stored in the database at a given point of time. Thus, it is a dynamic value which keeps on changing.  A database instance for the Person database can be (User1,emai.com,11345679,addr) So the person construct will contain their individual entities in the attributes called as instance. This is shown below − Prepared By: Ms. Sushma Malik
  • 65. SCHEMA VS INSTANCE Schema Instance It is the overall description of the database. It is the collection of information stored in a database at a particular moment. Schema is same for whole database. Data in instances can be changed using addition, deletion, updation. Does not change Frequently. Changes Frequently. Defines the basic structure of the database i.e how the data will be stored in the database. It is the set of Information stored at a particular time. Prepared By: Ms. Sushma Malik
  • 66. DATA INDEPENDENCE  Data independence is the ability to modify the scheme without affecting the programs and the application to be rewritten.  Data is separated from the programs, so that the changes made to the data will not affect the program execution and the application.  There are two levels of data independence based on three levels of abstraction. These are as follows −  Physical Data Independence  Logical Data Independence Prepared By: Ms. Sushma Malik
  • 67. PHYSICAL DATA INDEPENDENCE  Physical Data Independence means changing the physical level without affecting the logical level or conceptual level. Using this property, we can change the storage device of the database without affecting the logical schema.  The changes in the physical level may include changes using the following −  A new storage device like magnetic tape, hard disk, etc.  A new data structure for storage.  A different data access method or using an alternative files organization technique.  Changing the location of the database. Prepared By: Ms. Sushma Malik
  • 68. LOGICAL DATA INDEPENDENCE  Logical view of data is the user view of the data. It presents data in the form that can be accessed by the end users.  Logical data is data about database, that is, it stores information about how data is managed inside. For example, a table (relation) stored in the database and all its constraints, applied on that relation.  Logical data independence is a kind of mechanism, which liberalizes itself from actual data stored on the disk. If we do some changes on table format, it should not change the data residing on the disk.  Logical data independence is used to separate the external level from the conceptual view.  If we do any changes in the conceptual view of the data, then the user view of the data would not be affected.  Logical data independence occurs at the user interface level. Prepared By: Ms. Sushma Malik
  • 69. Prepared By: Ms. Sushma Malik
  • 70. DATA MODELLING USING ENTITY RELATIONSHIP MODEL Entity  An Entity may be an object with a physical existence – a particular person, car, house, or employee – or it may be an object with a conceptual existence – a company, a job, or a university course.  An Entity is an object of Entity Type and set of all entities is called as entity set. e.g.; E1 is an entity having Entity Type Student and set of all students is called Entity Set. In ER diagram, Entity Type is represented as: Prepared By: Ms. Sushma Malik
  • 71. Prepared By: Ms. Sushma Malik
  • 72. TYPES OF ENTITY TYPE  Strong Entity Type  Weak Entity Type  Strong Entity Type: Strong entity are those entity types which has a key attribute. The primary key helps in identifying each entity uniquely. It is represented by a rectangle. In example, Roll_no identifies each element of the table uniquely and hence, we can say that STUDENT is a strong entity type. Prepared By: Ms. Sushma Malik
  • 73. STRONG ENTITY TYPE Prepared By: Ms. Sushma Malik
  • 74. WEAK ENTITY TYPE  Weak Entity Type: Weak entity type doesn't have a key attribute.  Weak entity type can't be identified on its own. It depends upon some other strong entity for its distinct identity.  This can be understood with a real-life example. There can be children only if the parent exits. There can be no independent existence of children. There can be a room only if building exits. There can be no independent existence of a room.  A weak entity is represented by a double outlined rectangle.  The relationship between a weak entity type and strong entity type is called an identifying relationship and shown with a double outlined diamond instead of a single outlined diamond. Prepared By: Ms. Sushma Malik
  • 75. WEAK ENTITY TYPE Prepared By: Ms. Sushma Malik
  • 76. NOTATION FOR ER DIAGRAM Prepared By: Ms. Sushma Malik
  • 77. ATTRIBUTE  Attributes are the properties which define the entity type. For example, Roll_No, Name, DOB, Age, Address, Mobile_No are the attributes which defines entity type Student. In ER diagram, attribute is represented by an oval.  Types of Attributes:  Key Attribute –  The attribute which uniquely identifies each entity in the entity set is called key attribute.For example, Roll_No will be unique for each student. In ER diagram, key attribute is represented by an oval with underlying lines. Prepared By: Ms. Sushma Malik
  • 78. TYPES OF ATTRIBUTES  Composite Attribute – An attribute composed of many other attribute is called as composite attribute. For example, Address attribute of student Entity type consists of Street, City, State, and Country. In ER diagram, composite attribute is represented by an oval comprising of ovals. Prepared By: Ms. Sushma Malik
  • 79. TYPES OF ATTRIBUTES  Multivalued Attribute An attribute consisting more than one value for a given entity. For example, Phone_No (can be more than one for a given student). In ER diagram, multivalued attribute is represented by double oval. Derived Attribute – An attribute which can be derived from other attributes of the entity type is known as derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, derived attribute is represented by dashed oval. Prepared By: Ms. Sushma Malik
  • 80. KEYS  Keys are the attributes of the entity, which uniquely identifies the record of the entity. For example STUDENT_ID identifies individual students, passport#, license # etc.  As we have seen already, there are different types of keys in the database.  Super Key is the one or more attributes of the entity, which uniquely identifies the record in the database.  Candidate Key is one or more set of keys of the entity. For a person entity, his SSN, passport#, license# etc can be a super key. Prepared By: Ms. Sushma Malik
  • 81. KEYS  Primary Key is the candidate key, which will be used to uniquely identify a record by the query. Though a person can be identified using his SSN, passport# or license#, one can choose any one of them as primary key to uniquely identify a person. Rest of them will act as a candidate key.  Foreign Key of the entity attribute in the entity which is the primary key of the related entity. Foreign key helps to establish the mapping between two or more entities. Prepared By: Ms. Sushma Malik
  • 82. Prepared By: Ms. Sushma Malik
  • 83. FOREIGN KEY Prepared By: Ms. Sushma Malik
  • 84. RELATIONSHIP  A relationship defines how two or more entities are inter-related.  For example, STUDENT and CLASS entities are related as ‘Student X studies in a Class Y’.  Here ‘Studies’ defines the relationship between Student and Class.  Similarly, Teacher and Subject are related as ‘Teacher A teaches Subject B’. Here ‘teaches’ forms the relationship between both Teacher and Subject. Prepared By: Ms. Sushma Malik
  • 85. DEGREES OF RELATIONSHIP  In a relationship two or more number of entities can participate.  The number of entities who are part of a particular relationship is called degrees of relationship.  If only two entities participate in the mapping, then degree of relation is 2 or binary.  If three entities are involved, then degree of relation is 3 or ternary.  If more than 3 entities are involved then the degree of relation is called n-degree or n-nary. Prepared By: Ms. Sushma Malik
  • 86. CARDINALITY OF RELATIONSHIP  How many number of instances of one entity is mapped to how many number of instances of another entity is known as cardinality of a relationship.  In a ‘studies’ relationship above, what we observe is only one Student X is studying in on Class Y. i.e.; single instance of entity student mapped to a single instance of entity Class.  This means the cardinality between Student and Class is 1:1. Prepared By: Ms. Sushma Malik
  • 87. CARDINALITY OF RELATIONSHIP  Based on the cardinality, there are 3 types of relationship.  One-to-One (1:1): As we saw in above example, one instance of the entity is mapped to only one instance of another entity. Consider, HOD of the Department. There is only one HOD in one department. That is there is 1:1 relationship between the entity HOD and Department. Prepared By: Ms. Sushma Malik
  • 88. CARDINALITY OF RELATIONSHIP  One-to-Many (1: M): As we can guess now, one to many relationship has one instance of entity related to multiple instances of another entity. One manager manages multiple employees in his department. Here Manager and Employee are entities, and the relationship is one to many. Similarly, one teacher teaches multiple classes is also a 1: M relationship. Prepared By: Ms. Sushma Malik
  • 89. CARDINALITY OF RELATIONSHIP  Many-to-Many (M: N): This is a relationship where multiple instances of entities are related to multiple instances of another entity. A relationship between TEACHER and STUDENT is many to many. How? Multiple Teachers teach multiple numbers of Students. Prepared By: Ms. Sushma Malik
  • 90. ENHANCED ENTITY RELATIONSHIP MODEL (EER MODEL)  EER is a high-level data model that incorporates the extensions to the original ER model. It is a diagrammatic technique for displaying the following concepts  Sub Class and Super Class  Specialization and Generalization  Union or Category  Aggregation  These concepts are used when the comes in EER schema and the resulting schema diagrams called as EER Diagrams. Prepared By: Ms. Sushma Malik
  • 91. Features of EER Model  EER creates a design more accurate to database schemas.  It reflects the data properties and constraints more precisely.  It includes all modeling concepts of the ER model.  Diagrammatic technique helps for displaying the EER schema.  It includes the concept of specialization and generalization.  It is used to represent a collection of objects that is union of objects of different of different entity types. Prepared By: Ms. Sushma Malik
  • 92. SUB CLASS AND SUPER CLASS Sub class and Super class relationship leads the concept of Inheritance.  The relationship between sub class and super class is denoted with symbol. Super Class  Super class is an entity type that has a relationship with one or more subtypes.  An entity cannot exist in database merely by being member of any super class.  For example: Shape super class is having sub groups as Square, Circle, Triangle. Sub Class  Sub class is a group of entities with unique attributes.  Sub class inherits properties and attributes from its super class.  For example: Square, Circle, Triangle are the sub class of Shape super class. Prepared By: Ms. Sushma Malik
  • 93. SUB CLASS AND SUPER CLASS Prepared By: Ms. Sushma Malik
  • 94. GENERALIZATION  Generalization is the process of generalizing the entities which contain the properties of all the generalized entities.  It is a bottom approach, in which two lower level entities combine to form a higher level entity.  Generalization is the reverse process of Specialization.  It defines a general entity type from a set of specialized entity type.  It minimizes the difference between the entities by identifying the common features. Prepared By: Ms. Sushma Malik
  • 96. SPECIALIZATION  Specialization is a process that defines a group entities which is divided into sub groups based on their characteristic.  It is a top down approach, in which one higher entity can be broken down into two lower level entity.  It maximizes the difference between the members of an entity by identifying the unique characteristic or attributes of each member.  It defines one or more sub class for the super class and also forms the superclass/subclass relationship. Prepared By: Ms. Sushma Malik
  • 98.  Specialized classes are often called subclass while a generalized class is called a superclass, probably inspired by object-oriented programming.  A sub-class is best understood by “IS-A analysis”. Following statements hopefully makes some sense to your mind “Technician IS-A Employee”, “Laptop IS-A Computer”. Prepared By: Ms. Sushma Malik
  • 99. E-R DIAGRAM  An Entity–relationship model (ER model) describes the structure of a database with the help of a diagram, which is known as Entity Relationship Diagram (ER Diagram).  An ER model is a design or blueprint of a database that can later be implemented as a database.  The main components of E-R model are: entity set and relationship set.  An ER diagram shows the relationship among entity sets. An entity set is a group of similar entities and these entities can have attributes. In terms of DBMS, an entity is a table or attribute of a table in database, so by showing relationship among tables and their attributes, ER diagram shows the complete logical structure of a database. Prepared By: Ms. Sushma Malik
  • 100. E-R DIAGRAM Prepared By: Ms. Sushma Malik
  • 101. E-R DIAGRAM  In the following diagram we have two entities Student and College and their relationship.  The relationship between Student and College is many to one as a college can have many students however a student cannot study in multiple colleges at the same time.  Student entity has attributes such as Stu_Id, Stu_Name & Stu_Addr and College entity has attributes such as Col_ID & Col_Name. Prepared By: Ms. Sushma Malik
  • 102. COMPONENTS OF A ER DIAGRAM Prepared By: Ms. Sushma Malik
  • 103. REDUCTION OF ER DIAGRAM TO TABLE  The database can be represented using the notations, and these notations can be reduced to a collection of tables.  In the database, every entity set or relationship set can be represented in tabular form. Prepared By: Ms. Sushma Malik
  • 104. REDUCTION OF ER DIAGRAM TO TABLE Prepared By: Ms. Sushma Malik
  • 105. REDUCTION OF ER DIAGRAM TO TABLE  There are some points for converting the ER diagram to the table:  Entity type becomes a table.  In the given ER diagram, LECTURE, STUDENT, SUBJECT and COURSE forms individual tables.  All single-valued attribute becomes a column for the table.  In the STUDENT entity, STUDENT_NAME and STUDENT_ID form the column of STUDENT table. Similarly, COURSE_NAME and COURSE_ID form the column of COURSE table and so on.  A key attribute of the entity type represented by the primary key.  In the given ER diagram, COURSE_ID, STUDENT_ID, SUBJECT_ID, and LECTURE_ID are the key attribute of the entity. Prepared By: Ms. Sushma Malik
  • 106. REDUCTION OF ER DIAGRAM TO TABLE  The multivalued attribute is represented by a separate table.  In the student table, a hobby is a multivalued attribute. So it is not possible to represent multiple values in a single column of STUDENT table. Hence we create a table STUD_HOBBY with column name STUDENT_ID and HOBBY. Using both the column, we create a composite key.  Composite attribute represented by components.  In the given ER diagram, student address is a composite attribute. It contains CITY, PIN, DOOR#, STREET, and STATE. In the STUDENT table, these attributes can merge as an individual column. Prepared By: Ms. Sushma Malik
  • 107. REDUCTION OF ER DIAGRAM TO TABLE  Derived attributes are not considered in the table.  In the STUDENT table, Age is the derived attribute. It can be calculated at any point of time by calculating the difference between current date and Date of Birth.  Using these rules, you can convert the ER diagram to tables and columns and assign the mapping between the tables. Table structure for the given ER diagram is as below: Prepared By: Ms. Sushma Malik
  • 108. REDUCTION OF ER DIAGRAM TO TABLE Prepared By: Ms. Sushma Malik