SlideShare a Scribd company logo
1 of 172
Noida Institute of Engineering and Technology, Greater Noida
Introduction
Shabnam Firdaus
Assistant Professor
(AI)
4/23/2024
1
Unit: 1
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
DBMS
ACSAI0402
Course Details
(B Tech IVth Sem)
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 2
Name: Shabnam Firdaus
Qualification: B.Tech(IT), M.Tech (IT)
Area of Research: Machine Learning, Artificial
Intelligence
Contact Details:
Email: shabnam.firdaus@niet.co.in
Brief Introduction of Faculty member
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 3
Evaluation Scheme
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 4
Subject Syllabus
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 5
Subject Syllabus
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 6
Branch wise Applications
1.AI - Apache Cassandra is an open-source and highly scalable NoSQL database
management system that is designed to manage massive amounts of data in a
faster manner. This popular database is being used by GitHub, Netflix, Instagram,
Reddit, among others.
2. IoT - IoT devices' primary purpose is often to collect and/or generate data and
share it for some higher purpose such as analytics, machine learning and artificial
intelligence. Consequently, IoT DBMSs need to manage not just data at rest, but
also data in transit.
3. CS – There are various application of dbms in different fields like Railway
Reservation System, Library Management System, Banking, Universities and
colleges, Credit card transactions etc
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
7
Course Objective
• The objective of course is to present an introduction to database
management systems, with an emphasis on how to organize,
maintain and retrieve-efficiently, and effectively –information in
relational and non-relational Database.
• List and explain the fundamental concepts of a relational database
system
• Knowledge of DBMS, both in terms of use and
implementation/design.
• Experience with SQL and Manipulate a database using SQL
• Increased proficiency with the programming language C++.
• Experience working as part of team v Experience with analysis and
design of (DB) software
• Assess the quality and ease of use of data modeling and
diagramming tools.
8
Course Outcomes (COs)
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
4/23/2024 9
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
Engineering Graduates will be able to:
1. Engineering knowledge: Apply the knowledge of mathematics, science,
engineering fundamentals, and an engineering specialization to the solution of
complex engineering problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified
needs with appropriate consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge
and research methods including design of experiments, analysis and interpretation
of data, and synthesis of the information to provide valid conclusions.
Program Outcomes (POs)
4/23/2024 10
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
5. Modern tool usage: Create, select, and apply appropriate techniques,
resources, and modern engineering and IT tools including prediction and
modeling to complex engineering activities with an understanding of the
limitations.
6. The engineer and society: Apply reasoning informed by the contextual
knowledge to assess societal, health, safety, legal and cultural issues and
the consequent responsibilities relevant to the professional engineering
practice.
7. Environment and sustainability: Understand the impact of the
professional engineering solutions in societal and environmental contexts,
and demonstrate the knowledge of, and need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
Contd..
Program Outcomes (POs)
4/23/2024 11
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
9. Individual and team work: Function effectively as an individual, and as a
member or leader in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities
with the engineering community and with society at large, such as, being able to
comprehend and write effective reports and design documentation, make
effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and
understanding of the engineering and management principles and apply these
to one’s own work, as a member and leader in a team, to manage projects and
in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and
ability to engage in independent and life-long learning in the broadest context of
technological change.
Contd..
Program Outcomes (POs)
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
ASCAI0402.1
2 2 3 3 3 2 3 2 2 2 2 3
ACSAI0402.2
3 3 3 2 2 2 2 2 2 2 2 3
ACSAI0402.3
2 3 3 3 3 2 2 2 2 2 2 2
ACSAI0402.4
2 3 2 2 2 2 2 2 2 3 2 2
ACSAI0402.5
2 3 2 2 2 3 2 2 3 2 2 2
AVG
2.20 2.80 2.60 2.40 2.40 2.20 2.20 2.00 2.20 2.20 2.00 2.40
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 12
COs and POs Mapping
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 13
Program Specific Outcomes (PSOs)
On successful completion of graduation degree the Engineering graduates will
be able to:
PSO1: The ability to identify, analyze real world problems and design their ethical
solutions using artificial intelligence, robotics, virtual/augmented reality, data
analytics, block chain technology, and cloud computing.
PSO2:The ability to design and develop the hardware sensor devices and related
interfacing software systems for solving complex engineering problems.
PSO3:The ability to understand inter disciplinary computing techniques and to
apply them in the design of advanced computing.
PSO4: The ability to conduct investigation of complex problem with the help of
technical, managerial, leadership qualities, and moder engineering tools provided
by industry sponsored laboratories.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 14
COs and PSOs Mapping
Program Specific Outcomes
PSO1 PSO2 PSO3 PSO4
ACSAI0402.1
3 1 3 1
ACSAI0402.2
3 1 3 1
ACSAI0402.3
3 1 3 1
ACSAI0402.4
3 1 3 1
ACSAI0402.5
3 1 3 1
AVG
3.00 1.00 3.00 1.00
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 15
Program Educational Objectives (PEOs)
PEO1: To have an excellent scientific and engineering breadth so as to comprehend,
analyze, design and provide sustainable solutions for real-life problems using state-of-
the-art technologies.
PEO2:To have a successful career in industries, to pursue higher studies or to support
entrepreneurial endeavors and to face global challenges.
PEO3:To have an effective communication skills, professional attitude, ethical values
and a desire to learn specific knowledge in emerging trends, technologies for
research, innovation and product development and contribution to society.
PEO4: To have life-long learning for up-skilling and re-skilling for successful
professional career as engineer, scientist, entrepreneur and bureaucrat for betterment
of society
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 16
COs and PSOs Mapping
Program Specific Outcomes
PSO1 PSO2 PSO3 PSO4
ACSAI0402.1
3 1 3 1
ACSAI0402.2
3 1 3 1
ACSAI0402.3
3 1 3 1
ACSAI0402.4
3 1 3 1
ACSAI0402.5
3 1 3 1
AVG
3.00 1.00 3.00 1.00
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 17
Result Analysis
18
Question Paper Template
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
19
Question Paper Template
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
SECTION – A CO
1. Attempt all parts- [10×1=10]
1-a. Question- (1)
1-b. Question- (1)
1-c. Question- (1)
1-d. Question- (1)
1-e. Question- (1)
1-f. Question- (1)
1-g. Question- (1)
1-h. Question- (1)
1-i. Question- (1)
1-j. Question- (1)
2. Attempt all parts- [5×2=10] CO
2-a. Question- (2)
2-b. Question- (2)
2-c. Question- (2)
2-d. Question- (2)
2-e. Question- (2)
SECTION – B CO
3. Answer any five of the following- [5×6=30]
3-a. Question- (6)
3-b. Question- (6)
3-c. Question- (6)
3-d. Question- (6)
3-e. Question- (6)
3-f. Question- (6)
3-g. Question- (6)
SECTION – C CO
4 Answer any one of the following- [5×10=50]
4-a. Question- (10)
4-b. Question- (10)
5. Answer any one of the following-
5-a. Question- (10)
5-b. Question- (10)
6. Answer any one of the following-
6-a. Question- (10)
6-b. Question- (10)
7. Answer any one of the following-
7-a. Question- (10)
7-b. Question- (10)
8. Answer any one of the following-
8-a. Question- (10)
8-b. Question- (10)
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 20
Prerequisite and Recap
• There is No prerequisite for learning DBMS from scratch
although having basic knowledge of discrete mathematics and
data structure is added advantage.
• Having knowledge of basic mathematics like - SUM,
DIFFERENCE, AVERAGE, MEAN, MEDIAN, MODE, etc will
definitely be a plus point.
• Having knowledge on Set Theory will help.
• The proper understanding of data structures (B and B+ trees)
will help you to understand the DBMS quickly.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 21
Brief Introduction about the Subject with videos
1. A database management system (DBMS) refers to the technology for
creating and managing databases. DBMS is a software tool to organize
(create, retrieve, update, and manage) data in a database.
2. The main aim of a DBMS is to supply a way to store up and retrieve
database information that is both convenient and efficient. By data,
we mean known facts that can be recorded and that have embedded
meaning.
(15) 22 - DBMS - I – YouTube
(15) Lec 1: Introduction to DBMS | Database Management System –
YouTube
(15) Introduction to SQL | DDL, DML, DQL, DCL, TCL Commands in SQL -
YouTube
(15) NoSQL Tutorial for Beginners | Introduction to NoSQL Databases |
NoSQL Databases Tutorial – YouTube
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 22
Content – Unit 1
• Introduction: An overview of database management system,
database system Vs file system, Database system concept and
architecture, data model schema and instances, data independence
and database language and interfaces, data definitions language,
DML.
• Data Modeling using the Entity Relationship Model: ER model
concepts, notation for ER diagram, mapping constraints, keys,
Concepts of Super Key, candidate key, primary key, Generalization,
aggregation, reduction of an ER diagrams to tables, extended ER
model, relationship of higher degree.
4/23/2024 23
Unit Objective
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
1. The main objectives of database management system are data
availability, data integrity, data security, and data independence.
2. DDL stands for Data Definition Language. DML stands for Data
Manipulation Language. DDL statements are used to create
database, schema, constraints, users, tables etc. DML statement is
used to insert, update or delete the records.
3. ER diagrams are used to analyze existing databases to find and
resolve problems in logic or deployment. Drawing the diagram
should reveal where it's going wrong. Business information systems:
The diagrams are used to design or analyze relational databases
used in business processes.
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
24
Topic mapping with CO
Topic CO
Database system Vs File system CO1
Database system concepts, CO1
architecture and structures CO1
data model
schema and instances
CO1
Data independence and Database
language and Interfaces
CO1
Data Modeling using the Entity
Relationship Model
CO1
ER model concepts CO1
notation for ER diagram CO1
mapping constraints CO1
keys CO1
Concepts of Super Key CO1
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
25
Topic mapping with CO
Topic CO
Candidate key CO1
Primary key CO1
Generalization, Aggregation CO1
Reduction
of an ER diagrams to tables
CO1
Extended ER model CO1
Relationship of higher degree. CO1
Lecture 1
• Why we use DBMS
• File vs DBMS
• Purpose of Database system
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
26
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 27
Topic – DBMS Objective
The main objectives of database
management system are data availability,
data integrity, data security, and data
independence.
• A very large, integrated collection of related data.
• Models real-world enterprise.
– Entities (e.g., students, courses)
– Relationships (e.g., Madonna is taking CS564)
• A Database Management System (DBMS) is a
software package designed to define,construct and
manipulate database.
• Database + Database Management System=
Database System.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 28
What is a DBMS? (CO1)
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 29
Why Use a DBMS?
• Data independence and efficient access.
• Reduced application development time.
• Data integrity and security.
• Uniform data administration.
• Concurrent access, recovery from crashes.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 30
Why Study Databases?
 Shift from computation to information
 at the “low end”: scramble to webspace (a mess!)
 at the “high end”: scientific applications
 Datasets increasing in diversity and volume.
 Digital libraries, interactive video, Human Genome
project, EOS project
 ... need for DBMS exploding
 DBMS encompasses most of CS
 OS, languages, theory, AI, multimedia, logic
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 31
Files vs. DBMS
• The file system is basically a way of
arranging the files in a storage medium like a
hard disk.
• The file system organizes the files and helps
in the retrieval of files when they are required.
• File systems consist of different files which
are grouped into directories.
• The directories further contain other folders
and files. The file system performs basic
operations like management, file naming,
giving access rules, etc.
• Example: NTFS(New Technology File
System), EXT(Extended File System).
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 32
Files vs. DBMS
Basis File System DBMS
Structure
The file system is software that manages
and organizes the files in a storage
medium within a computer.
DBMS is software for managing the
database.
Data Redundancy
Redundant data can be present in a file
system.
In DBMS there is no redundant
data.
Backup and Recovery
It doesn’t provide backup and recovery of
data if it is lost.
It provides backup and recovery of
data even if it is lost.
Query processing
There is no efficient query processing in
the file system.
Efficient query processing is there in
DBMS.
Consistency
There is less data consistency in the file
system.
There is more data consistency
because of the process of
normalization.
Complexity It is less complex as compared to DBMS.
It has more complexity in handling
as compared to the file system.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 33
Files vs. DBMS
Security Constraints
File systems provide less security
in comparison to DBMS.
DBMS has more security
mechanisms as compared to file
systems.
Cost It is less expensive than DBMS.
It has a comparatively higher cost
than a file system.
Data Independence There is no data independence.
In DBMS data independence
exists.
User Access
Only one user can access data at a
time.
Multiple users can access data at
a time.
Meaning
The user has to write procedures
for managing databases
The user not required to write
procedures.
Sharing
Data is distributed in many files.
So, not easy to share data
Due to centralized nature sharing
is easy
Data Abstraction
It give details of storage and
representation of data
It hides the internal details of
Database
Integrity Constraints
Integrity Constraints are difficult to
implement
Integrity constraints are easy to
implement
Example Cobol, C++ Oracle, SQL Server
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 34
Purpose of Database Systems
 In the early days, database applications were built directly on top of
file systems
 Drawbacks of using file systems to store data:
 Data redundancy and inconsistency
 Multiple file formats, duplication of information in different
files
 Difficulty in accessing data
 Need to write a new program to carry out each new task
 Data isolation — multiple files and formats
 Integrity problems
 Integrity constraints (e.g. account balance > 0) become
“buried” in program code rather than being stated explicitly
 Hard to add new constraints or change existing ones
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 35
Purpose of Database Systems (Cont.)
• Drawbacks of using file systems (cont.)
– Atomicity of updates
• Failures may leave database in an inconsistent state with partial
updates carried out
• Example: Transfer of funds from one account to another should
either complete or not happen at all
– Concurrent access by multiple users
• Concurrent access needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
– Example: Two people reading a balance and updating it at the
same time
– Security problems
• Hard to provide user access to some, but not all, data
• Database systems offer solutions to all the above problems
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 36
Summary
• DBMS used to maintain, query large datasets.
• Benefits include recovery from system crashes,
concurrent access, quick application development,
data integrity and security.
• Levels of abstraction give data independence.
• A DBMS typically has a layered architecture.
• DBAs hold responsible jobs and are well-paid!
• DBMS R&D is one of the broadest, most exciting
areas in CS.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 37
Short Quiz
1. Which of the following is a NoSQL Database Type?
a) SQL
b) Database Management System
c) Database Management Service
d) Data Backup Management System
2. What is a database?
a) Organized collection of information that cannot be
accessed, updated, and managed
b) Collection of data or information without organizing
c) Organized collection of data or information that can be
accessed, updated, and managed
d) Organized collection of data that cannot be updated
Lecture 2
• Data Models
• Database Arcitecture
• Schema and instances
• Levels of Abstraction
• Data Independence
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
38
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 39
Topic – Data models Objective
1. Data Model gives us an idea that how the final
system will look like after its complete
implementation.
2. It defines the data elements and the
relationships between the data elements.
3. Data Models are used to show how data is
stored, connected, accessed and updated in the
database management system.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 40
Data Models
• Data models define how the logical structure of a database is modeled.
• Data models define how data is connected to each other and how they are
processed and stored inside the system.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 41
Data Models
1) Relational Data Model: This type of model designs the data in the
form of rows and columns within a table. Thus, a relational model uses
tables for representing data and in-between relationships. Tables are
also called relations.
2) Entity-Relationship Data Model: An ER model is the logical
representation of data as objects and relationships among them.
These objects are known as entities, and relationship is an association
among these entities.
3) Object-based Data Model: An extension of the ER model with
notions of functions, encapsulation, and object identity, as well. This
model supports a rich type system that includes structured and
collection types. Both the data and the relationship are contained in a single
structure that is known as an object in this model. We can now store audio, video,
pictures, and other types of data in databases, which was previously impossible with
the relational approach
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 42
Data Models
4) Semistructured Data Model: This type of data model is
different from the other three data models (explained
above). The semistructured data model allows the data
specifications at places where the individual data items of
the same type may have different attributes sets.
5)Hierarchical Model: This concept uses a hierarchical tree
structure to organise the data. The hierarchy begins at the
root, which contains root data, and then grows into a tree
as child nodes are added to the parent node.
6) Network Model : The main difference between this
model and the hierarchical model is that any record can
have several parents in the network model. It uses a graph
instead of a hierarchical tree.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 43
DBMS Architecture
• Two-tier architecture:
The two-tier architecture is similar to a basic client-
server model.
• The application at the client end directly
communicates with the database at the server side
using API.
• (Application Programming Interface (API) is a
software interface that allows two applications to
interact with each other without any user
intervention. API is a collection of software
functions and procedures. In simple terms, API
means a software code that can be accessed or
executed. API is defined as a code that helps two
different software’s to communicate and
data with each other.)
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 44
DBMS Architecture
• The server side is responsible for providing query
processing and transaction management
functionalities.
• On the client side, the user interfaces and
application programs are run. The application on
the client side establishes a connection with the
server side in order to communicate with the
DBMS.
An advantage of this type is that maintenance and
understanding are easier, and compatible with
existing systems. However, this model gives poor
performance when there are a large number of
users.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 45
DBMS Architecture
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 46
DBMS Architecture
• The main disadvantages of Two-Tier
DBMS Architecture are:
• Scalability - As the number of clients
increases, the load on the server
increases. Thereby declining the
performance of the DBMS and, in turn,
the client-side application.
• Security - The Direct connection between
the client and server systems makes this
architecture vulnerable to attacks.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 47
DBMS Architecture
• Three Tier architecture:
In this type, there is another layer between the client
and the server.
• The client does not directly communicate with the
server. Instead, it interacts with an application server
which further communicates with the database
system and then the query processing and
transaction management takes place.
• This intermediate layer acts as a medium for the
exchange of partially processed data between
server and client.
• This type of architecture is used in the case of large
web applications.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 48
DBMS Architecture
A 3-tier architecture has the following layers:
1. Presentation layer (your PC, Tablet, Mobile, etc.)
2. Application layer (server)
3. Database Server
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 49
DBMS Architecture
• The main advantages of Three Tier DBMS
Architecture are:
• Scalability - Since the database server isn't
aware of any users beyond the application
layer and the application layer implements
load balancing, there can be as many clients as
you want.
• Data Integrity - Data corruption and bad
requests can be avoided because of the checks
performed in the application layer on each
client reques.
• Security - The removal of the direct
connection between the client and server
systems via abstraction reduces unauthorized
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 50
Schemas and Instances
• Similar to types and variables in programming languages
• Schema – the logical structure of the database
– Example: The database consists of information about
a set of customers and accounts and the relationship
between them
– Analogous to type information of a variable in a
program
• Instance – the actual content of the database at a
particular point in time
– Analogous to the value of a variable
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 51
Schemas and Instances
• What is a Schema?
• It refers to an overall description that we get for any
given database. In simpler words, schema refers to the
basic structure of how one needs to store data in any
database. There are basically two types of Schema:
Physical Schema and Logical Schema.
• Physical Schema – This schema describes the DB
designed at a physical level.
• Logical Schema – This schema describes the DB
designed at a logical level.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 52
Schemas and Instances
• Example: Let’s say a table teacher in our
database name school, the teacher table
require the name, dob, doj in their table so we
design a structure as
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 53
•Physical Database Schema − This schema pertains to the actual storage of
data and its form of storage like files, indices, etc. It defines how the data will
be stored in a secondary storage.
•Logical Database Schema − This schema defines all the logical constraints
that need to be applied on the data stored. It defines tables, views, and
integrity constraints.
Schemas and Instances
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 54
Schemas and Instances
• What are Instances?
• These refer to a collection of all the information and
data stored at any given moment.
• One can easily change these instances using certain
operations, such as deletion and addition of data and
information.
• Example : Let’s say a table teacher in our database
whose name is School, suppose the table has 50
records so the instance of the database has 50
records for now and tomorrow we are going to add
another fifty records so tomorrow the instance have
total 100 records. This is called an instance.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 55
Schemas and Instances
Parameters Schema in DBMS Instance in DBMS
Meaning Schema refers to the
overall description of any
given database.
Instance basically refers to
a collection of data and
information that the
database stores at any
particular moment.
Alterations The schema remains the
same for the entire
database as a whole.
One can change the
instances of data and
information in a database
using updation, deletion,
and addition.
Frequency of Change It does not change very
frequently.
It changes very frequently.
Uses We use Schema for
defining the basic
structure of any given
database. It defines how
the available needs to get
stored.
We use Instance for
referring to a set of
information at any given
instance/ time.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 56
Levels of Abstraction
• Physical Schema/Level: describes how a record (e.g., customer) is
stored.
• Logical Schema/Level: describes data stored in database, and the
relationships among the data.
type customer = record
customer_id : string;
customer_name : string;
customer_street : string;
customer_city : string;
end;
• External Schema/Level: application programs hide details of data
types. Views can also hide information (such as an employee’s
salary) for security purposes.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 57
Data Abstraction
• Data Abstraction is a process of hiding unwanted
or irrelevant details from the end user. It provides
a different view and helps in achieving data
independence which is used to enhance the
security of data.
• The database systems consist of complicated data
structures and relations. For users to access the
data easily, these complications are kept hidden,
and only the relevant part of the database is made
accessible to the users through data abstraction.
• Three Schema Architecture for a Database System
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 58
Three schema Architecture
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 59
Three schema Architecture
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 60
Three schema Architecture
• Objectives of Three schema Architecture
• The main objective of three level architecture is to enable multiple
users to access the same data with a personalized view while
storing the underlying data only once.
• Different users need different views of the same data.
• The approach in which a particular user needs to see the data may
change over time.
• The users of the database should not worry about the physical
implementation and internal workings of the database such as data
compression and encryption techniques, hashing, optimization of the
internal structures etc.
• All users should be able to access the same data according to their
requirements.
• DBA should be able to change the conceptual structure of the
database without affecting the user's
• Internal structure of the database should be unaffected by changes
to physical aspects of the storage.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 61
Three schema Architecture
Conceptual Schema
• The conceptual schema describes the design of a
database at the conceptual level. Conceptual
level is also known as logical level.
• The conceptual schema describes the structure
of the whole database.
• The conceptual level describes what data are to
be stored in the database and also describes
what relationship exists among those data.
• In the conceptual level, internal details such as
an implementation of the data structure are
hidden.
• Programmers and database administrators work
at this level.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 62
Three schema Architecture
View Layer
• Each view schema describes the database
part that a particular user group is
interested and hides the remaining
database from that user group.
• The view schema describes the end user
interaction with database systems.
• It also simplifies interaction with the user
and it provides many views or multiple
views of the same database.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 63
Example: University Database
 Physical schema:
 Relations stored as unordered files.
 Index on first column of Students.
 Conceptual schema:
 Students(sid: string, name: string, login: string, age: integer,
gpa:real)
 Courses(cid: string, cname:string, credits:integer)
 Enrolled(sid:string, cid:string, grade:string)
 External Schema (View):
 View1- Course_info(cid:string,enrollment:integer)
 View2-studeninfo(id:int. name:string)
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 64
Data Independence
• Data Independence is defined as a property of DBMS that helps you
to change the Database schema at one level of a database system
without requiring to change the schema at the next higher level.
• Data independence helps you to keep data separated from all
programs that make use of it.
• We know the main purpose of the three levels of data abstraction is
to achieve data independence. If the database changes and expands
over time, it is very important that the changes in one level should
not affect the data at other levels of the database. This would save
time and cost required when changing the database.
• There are two levels of data independence based on three levels of
abstraction. These are as follows −
• Physical Data Independence
• Logical Data Independence
 One of the most important benefits of using a DBMS!
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 65
Data Independence
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 66
Physical Data Independence
• Physical data independence can be defined as the capacity to
change the internal schema without having to change the
conceptual schema.
• If we do any changes in the storage size of the database
system server, then the Conceptual structure of the database
will not be affected.
• Physical data independence is used to separate conceptual
levels from the internal levels.
• Physical data independence occurs at the logical interface
level.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 67
Physical Data Independence (contd..)
• Due to Physical independence, any of the below change will
not affect the conceptual layer.
– Using a new storage device like Hard Drive or Magnetic
Tapes
– Modifying the file organization technique in the Database
– Switching to different data structures.
– Changing the access method.
– Modifying indexes.
– Changes to compression techniques or hashing algorithms.
– Change of Location of Database from say C drive to D Drive
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 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 independence refers characteristic of being able to
change the conceptual schema without having to change the
external schema.
• 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.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 69
Logical Data Independence (contd..)
• Due to Logical independence, any of the below
change will not affect the external layer.
– Add/Modify/Delete a new attribute, entity or
relationship is possible without a rewrite of
existing application programs
– Merging two records into one
– Breaking an existing record into two or more
records
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 70
Short Quiz
1. Which of the following is known as a set of entities of the same
type that share same properties, or attributes?
a) Relation set
b) Tuples
c) Entity set
d) Entity Relation model
2. The values appearing in given attributes of any tuple in the
referencing relation must likewise occur in specified attributes
of at least one tuple in the referenced relation, according to
_____________________ integrity constraint.
a) Referential
b) Primary
c) Referencing
d) Specific
Lecture 3
• DATA BASE LANGUAGES
• Data Definition Language (DDL)
• Data Manipulation Language
• Data Control Language
• Transaction Control Language (TCL)
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
71
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 72
DATA BASE LANGUAGE (CO1)
• A DBMS has appropriate languages and interfaces to express
database queries and updates.
• Database languages can be used to read, store and update the
data in the database.
• Two classes of languages
– Procedural – user specifies what data is required and how
to get those data
– Declarative (nonprocedural) – user specifies what data is
required without specifying how to get those data
• SQL is the most widely used query language
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 73
Topic- Database Language Objective
1. DDL stands for Data Definition Language. DML stands for
Data Manipulation Language. DDL statements are used to
create database, schema, constraints, users, tables etc. DML
statement is used to insert, update or delete the records.
2. DCL (Data Control Language) includes commands like GRANT
and REVOKE, which are useful to give “rights & permissions.”
3. Transaction control language or TCL commands deal with
the transaction within the database.
4. Data Query Language (DQL) is used to fetch the data from
the database.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 74
DATA BASE LANGUAGE
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 75
Data Definition Language (DDL)
• DDL stands for Data Definition Language. It is used to
define database structure or pattern.
• It is used to create schema, tables, indexes,
constraints, etc. in the database.
• Using the DDL statements, you can create the
skeleton of the database.
• Data definition language is used to store the
information of metadata like the number of tables
and schemas, their names, indexes, columns in each
table, constraints, etc.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 76
Data Definition Language (DDL)
• Here are some tasks that come under DDL:
– Create: It is used to create objects in the database.
– Alter: It is used to alter the structure of the database.
– Drop: It is used to delete objects from the database.
– Truncate: It is used to remove all records from a table.
– Rename: It is used to rename an object.
– Comment: It is used to comment on the data
dictionary.
These commands are used to update the database schema
that's why they come under Data definition language.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 77
Data Manipulation Language (DML)
• DML stands for Data Manipulation Language. It is used for accessing
and manipulating data in a database. It handles user requests.
• Here are some tasks that come under DML:
– Select: It is used to retrieve data from a database.
– Insert: It is used to insert data into a table.
– Update: It is used to update existing data within a table.
– Delete: It is used to delete all records from a table.
– Merge: It performs UPSERT operation, i.e., insert or update
operations.
– Call: It is used to call a structured query language or a Java
subprogram.
– Explain Plan: It has the parameter of explaining data.
– Lock Table: It controls concurrency.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 78
Data Control Language (DCL)
• DCL stands for Data Control Language. It is used to retrieve the
stored or saved data.
• The DCL execution is transactional. It also has rollback parameters.
(But in Oracle database, the execution of data control language does
not have the feature of rolling back.)
• Here are some tasks that come under DCL:
– Grant: It is used to give user access privileges to a database.
– Revoke: It is used to take back permissions from the user.
There are the following operations which have the authorization of
Revoke:
• CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 79
Transaction Control Language (TCL)
• TCL is used to run the changes made by the DML
statement. TCL can be grouped into a logical
transaction.
• Here are some tasks that come under TCL:
– Commit: It is used to save the transaction on the
database.
– Rollback: It is used to restore the database to
original since the last Commit.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 80
4/23/2024 80
Delete, Drop and Truncate
DELETE Command DROP Command
TRUNCATE Command
Language
The DELETE command is Data Manipulation
Language Command.
The DROP command is Data
Definition Language Command.
The TRUNCATE command is a Data
Definition Language Command.
Use
The DELETE command deletes one or more
existing records from the table in the
database.
The DROP Command drops the
complete table from the database.
The TRUNCATE Command deletes all the
rows from the existing table, leaving the
row with the column names.
Transition
We can restore any deleted row or multiple
rows from the database using the
ROLLBACK command.
We cannot get the complete table
deleted from the database using
the ROLLBACK command.
We cannot restore all the deleted rows
from the database using the ROLLBACK
command.
Memory Space
The DELETE command does not free the
allocated space of the table from memory.
The DROP command removes the
space allocated for the table from
memory.
The TRUNCATE command does not free
the space allocated for the table from
memory.
Performance Speed
The DELETE command performs slower
than the DROP command and TRUNCATE
command as it deletes one or more rows
based on a specific condition.
The DROP Command has faster
performance than DELETE
Command but not as compared to
the Truncate Command because
the DROP command deletes the
table from the database after
deleting the rows.
The TRUNCATE command works faster
than the DROP command and DELETE
command because it deletes all the
records from the table without any
condition.
Permission
DELETE permission is required to delete the
rows of the table.
We need ALTER permission on the
schema to which the table belongs
and CONTROL permission on the
table to use the DROP command.
We need table ALTER permission to use
the TRUNCATE command.
Syntax
DELETE FROM table_name WHERE
condition;
DROP TABLE table_name; TRUNCATE TABLE table_name;
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 81
4/23/2024 81
Short Quiz
1. The ability to query data, as well as insert, delete, and alter
tuples, is offered by ____________
a) TCL (Transaction Control Language)
b) DCL (Data Control Language)
c) DDL (Data Definition Langauge)
d) DML (Data Manipulation Langauge)
2. Which command is used to remove a relation from an SQL?
a) Drop table
b) Delete
c) Purge
d) Remove
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 82
Short Quiz
1.Explain the terms database and DBMS. Also, mention the
different types of DBMS.
2.What are the advantages of DBMS?
3.Mention the different languages present in DBMS
4.What are the different levels of abstraction in the DBMS?
5.Write Difference between schema and instances.
Lecture 4
• ER Model
• Entity and attributes
• Relationship and degree of relationship
• Mapping Cardinality
• Participation Constraint
• Keys in DBMS
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
83
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
84
Topic- ER Model Objective
1. An entity relationship diagram gives a snapshot of how these
entities relate to each other. You could call it the blueprint that
underpins your business architecture, offering a visual
representation of the relationships between different sets of data
(entities).
2. An Entity Relationship (ER) Diagram is a type of flowchart
that illustrates how “entities” such as people, objects or concepts
relate to each other within a system.
3. It is a diagrammatic approach to database design,
where you represent real-world objects as entities and
mention relationships between them.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 85
Introduction of ER Model
• A database can be modeled as:
– a collection of entities,
– relationship among entities.
• An entity is an object that exists and is distinguishable from other
objects.
– Example: specific person, company, event, plant
• Entities have attributes
– Example: people have names and addresses
• An entity set is a set of entities of the same type that share the
same properties.
– Example: set of all persons, companies, trees, holidays
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 86
Introduction of ER Model
• Entity: An entity is a real-world object having attributes,
which are nothing but characteristics of that particular object.
employee can be an entity. This particular entity can have
empname, etc.
• Entity Type: Entity type is nothing but a collection of entities,
having the same attributes. Generally, an entity type refers to
tables in a particular database. So, you can understand, entity
characteristic which uniquely identifies the entity. For
have attributes such as empid, empname, department, etc.
• Entity Set: An entity set is the collection of all the entities of a
particular entity type in a database. For example, a set of
companies, and a set of people can come under an entity set.
•
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 87
Entity Sets customer and loan
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 88
Attributes
• An entity is represented by a set of attributes, that is descriptive
properties possessed by all members of an entity set.
• In ER diagram, attribute is represented by an oval.
• Domain – the set of permitted values for each attribute
Example: customer = (customer_id, customer_name, customer_street,
customer_city )
loan = (loan_number, amount )
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 89
Attribute Type
• 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.
• 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.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 90
Attribute Type
• 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.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 91
Attribute Type
• The complete entity type Student with its attributes can be
represented as:
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 92
Degree of Relationship Set
• In DBMS, a degree of relationship represents the number of entity
types that associate in a relationship.
• The number of different entity sets participating in a relationship
set is called as degree of a relationship set.
– Unary Relationship
– Binary Relationship
– n-ary Relationship
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 93
Unary Relationship
• When there is only ONE entity set participating in a relation, the
relationship is called as unary relationship.
• For example, monitor is being selected from the students of the
class
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 94
Binary Relationship
• When there are TWO entities set participating in a relation, the
relationship is called as binary relationship.
• For example, Student is enrolled in Course.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 95
n-ary Relationship
• When there are n entities set participating in a relation, the
relationship is called as n-ary relationship.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 96
Mapping Cardinalities/Degree
• Mapping cardinalities or cardinality ratio express the number of
entities to which another entity can be associated via a relationship
set.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 97
Mapping Cardinalities
Types of cardinality in between tables are:
•one-to-one
•one-to-many
•many-to-one
•many-to-many
1. One-to-one: In this type of cardinality mapping, an entity in A is
connected to at most one entity in B. Or we can say that a unit or
item in B is connected to at most one unit or item in A.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 98
Mapping Cardinalities
Example:
In a particular hospital, the surgeon department has one head of department. They
both serve one-to-one relationships.
2. One-to-many: In this type of cardinality mapping, an entity in A is
associated with any number of entities in B. Or we can say that one unit or
item in B can be connected to at most one unit or item in A.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 99
Mapping Cardinalities
Example:
A doctor can prescribe more than one medicine
3. Many-to-one: In this type of cardinality mapping, an entity in A is
connected to at most one entity in B. Or we can say a unit or item in B can
be associated with any number (zero or more) of entities or items in A.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 100
Mapping Cardinalities
Example:
In a particular hospital, multiple surgeries are done by a single surgeon.
Such a type of relationship is known as a many-to-one relationship.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 101
Mapping Cardinalities
4. Many-to-many: In this type of cardinality mapping, an entity in A is
associated with any number of entities in B, and an entity in B is associated
with any number of entities in A.
Example:
In a particular company, multiple people work on multiple projects. They serve
many-to-many relationships.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 102
Participation Constraint
• Total Participation – Each entity in the entity set must participate in
the relationship. If each student must enroll in a course, the
participation of student will be total. Total participation is shown by
double line in ER diagram.
• Partial Participation – The entity in the entity set may or may NOT
participate in the relationship. If some courses are not enrolled by
any of the student, the participation of course will be partial.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 103
Participation Constraint (contd..)
• Using set, it can be represented as
• Every student in Student Entity set is participating in relationship
but there exists a course C4 which is not taking part in the
relationship.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 104
Weak Entity Type & Identifying Relationship
• An entity type has a key attribute which uniquely identifies each
entity in the entity set.
• But there exists some entity type for which key attribute can’t be
defined. These are called Weak Entity type.
• For example, A company may store the information of dependents
(Parents, Children, Spouse) of an Employee.
• But the dependents don’t have existence without the employee.
• So Dependent will be weak entity type and Employee will be
Identifying Entity type for Dependent.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 105
Weak Entity Type & Identifying Relationship
• A weak entity type is represented by a double rectangle. The
participation of weak entity type is always total. The relationship
between weak entity type and its identifying strong entity type is
called identifying relationship and it is represented by double
diamond.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 106
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 107
Keys in DBMS
• KEYS in DBMS is an attribute or set of attributes which helps you to
identify a row(tuple) in a relation(table).
• They allow you to find the relation between two tables.
• Keys help you uniquely identify a row in a table by a combination of
one or more columns in that table.
Example:-
• In the above-given example, employee ID is a primary key because
it uniquely identifies an employee record. In this table, no other
employee can have the same employee ID.
Employee ID FirstName LastName
11 Andrew Johnson
22 Tom Wood
33 Alex Hale
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 108
Why we need a Key?
Here are some reasons for using SQL key in the DBMS system.
• Keys help you to identify any row of data in a table.
• In a real-world application, a table could contain thousands of
records. Moreover, the records could be duplicated.
• Keys in RDBMS ensure that you can uniquely identify a table record
despite these challenges.
• Allows you to establish a relationship between and identify the
relation between tables
• Help you to enforce identity and integrity in the relationship.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 109
Types of Keys in DBMS
There are mainly seven different types of Keys in DBMS and each key
has it’s different functionality:
– Super Key – A super key is a group of single or multiple keys
which identifies rows in a table.
– Primary Key – is a column or group of columns in a table that
uniquely identify every row in that table.
– Candidate Key – is a set of attributes that uniquely identify
tuples in a table. Candidate Key is a super key with no
repeated attributes.
– Alternate Key – is a column or group of columns in a table that
uniquely identify every row in that table.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 110
Types of Keys in DBMS (contd..)
– Foreign Key – is a column that creates a
relationship between two tables. The purpose of
Foreign keys is to maintain data integrity and allow
navigation between two different instances of an
entity.
– Compound Key – has two or more attributes that
allow you to uniquely recognize a specific record. It
is possible that each column may not be unique by
itself within the database.
– Composite Key – is a combination of two or more
columns that uniquely identify rows in a table. The
combination of columns guarantees uniqueness,
though individual uniqueness is not guaranteed.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 111
Super key
• A superkey is a group of single or multiple keys which identifies
rows in a table. A Super key may have additional attributes that are
not needed for unique identification.
Example:
• In the above-given example, EmpSSN and EmpNum name are
superkeys.
EmpSSN EmpNum Empname
9812345098 AB05 Shown
9876512345 AB06 Roslyn
199937890 AB07 James
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 112
Primary Key
• PRIMARY KEY in DBMS is a column or group of columns in a table
that uniquely identify every row in that table. The Primary Key can’t
be a duplicate meaning the same value can’t appear more than
once in the table. A table cannot have more than one primary key.
Example:
• In the following example, StudID is a Primary Key.
StudID Roll No First Name LastName Email
1 11 Tom Price abc@gmail.com
2 12 Nick Wright xyz@gmail.com
3 13 Dana Natan mno@yahoo.com
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 113
Primary Key (contd..)
Rules for defining Primary key:
• Two rows can’t have the same primary key value
• The primary key field cannot be null.
• The value in a primary key column can never be modified or
updated if any foreign key refers to that primary key.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 114
Alternate key
• ALTERNATE KEYS is a column or group of columns in a table that
uniquely identify every row in that table. A table can have multiple
choices for a primary key but only one can be set as the primary
key. All the keys which are not primary key are called an Alternate
Key.
Example:
• In this table, StudID, Roll No, Email are qualified to become a
primary key. But since StudID is the primary key, Roll No, Email
becomes the alternative key.
StudID Roll No First Name LastName Email
1 11 Tom Price abc@gmail.com
2 12 Nick Wright xyz@gmail.com
3 13 Dana Natan mno@yahoo.com
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 115
Candidate Key
• CANDIDATE KEY in SQL is a set of attributes that uniquely identify
tuples in a table. Candidate Key is a super key with no repeated
attributes. The Primary key should be selected from the candidate
keys. Every table must have at least a single candidate key. A table
can have multiple candidate keys but only a single primary key.
Example:
• Candidate key Example: In the given table Stud ID, Roll No, and
email are candidate keys which help us to uniquely identify the
student record in the table.
StudID Roll No First Name LastName Email
1 11 Tom Price abc@gmail.com
2 12 Nick Wright xyz@gmail.com
3 13 Dana Natan mno@yahoo.com
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 116
Candidate Key (contd..)
Properties of Candidate key:
• It must contain unique values
• Candidate key in SQL may have multiple attributes
• Can contain null values
• It should contain minimum fields to ensure uniqueness
• Uniquely identify each record in a table
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 117
Foreign key
• FOREIGN KEY is an attribute that creates a relationship between
two tables. The purpose of Foreign keys is to maintain data integrity
and allow navigation between two different instances of an entity. It
acts as a cross-reference between two tables as it references the
primary key of another table.
Example:
Persons Table orders
Person
ID
LastNa
me
FirstNa
me
Age
1 Hansen Ola 30
2 Svends
on
Tove 23
3 Petters
en
Kari 20
OrderI
D
OrderNum
ber
PersonID
1 77895 3
2 44678 3
3 22456 2
4 24562 1
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 118
Foreign key (contd..)
• "PersonID" column in the "Orders" table points to the "PersonID" column in the
"Persons" table.
• The "PersonID" column in the "Persons" table is the PRIMARY KEY in the "Persons"
table.
• The "PersonID" column in the "Orders" table is a FOREIGN KEY in the "Orders"
table.
• The FOREIGN KEY constraint prevents invalid data from being inserted into the
foreign key column, because it has to be one of the values contained in the parent
table.
• Syntax:
CREATE TABLE Orders (
OrderID int NOT NULL,
OrderNumber int NOT NULL,
PersonID int,
PRIMARY KEY (OrderID),
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID));
• This concept is also known as Referential Integrity.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 119
Compound key
• COMPOUND KEY has two or more attributes that allow you to uniquely
recognize a specific record. It is possible that each column may not be
unique by itself within the database. However, when combined with
the other column or columns the combination of composite keys
become unique.
Example:
• In this example, OrderNo and ProductID can’t be a primary key as it
does not uniquely identify a record. However, a compound key of Order
ID and Product ID could be used as it uniquely identified each record.
OrderNo PorductID Product Name Quantity
B005 JAP102459 Mouse 5
B005 DKT321573 USB 10
B005 OMG446789 LCD Monitor 20
B004 DKT321573 USB 15
B002 OMG446789 Laser Printer 3
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 120
Composite key
• COMPOSITE KEY is a combination of two or more columns that
uniquely identify rows in a table. The combination of columns
guarantees uniqueness, though individually uniqueness is not
guaranteed. Hence, they are combined to uniquely identify records
in a table.
• The difference between compound and the composite key is that
any part of the compound key can be a foreign key, but the
composite key may or maybe not a part of the foreign key.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 121
Difference b/w Primary key & Foreign key
Primary Key Foreign Key
Helps you to uniquely identify a record in
the table.
It is a field in the table that is the primary
key of another table.
Primary Key never accept null values.
A foreign key may accept multiple null
values.
Primary key is a clustered index and data
in the DBMS table are physically organized
in the sequence of the clustered index.
A foreign key cannot automatically create
an index, clustered or non-clustered.
However, you can manually create an
index on the foreign key.
You can have the single Primary key in a
table.
You can have multiple foreign keys in a
table.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 122
Short Quiz
Q. Given the basic ER and relational models, which of the following is
INCORRECT?
answer choices
1. An attribute of an entity can have more than one value.
2. An attribute of an entity can be composite.
3. In a row of a relational table, an attribute can have more than one
value.
4. In a row of a relational table, an attribute can have exactly one value
or a NULL value.
Q. Which type of entity cannot exist in the database unless another type
of entity also exists in the database, but does not require that the
identifier of that other entity be included as part of its own identifier?
1. Weak entity
2. Strong entity
3. ID-dependent entity
4. ID- independent entity
Lecture 6
• Generalization, Specialization and Aggregation
• Reduction of an ER diagram to tables
• Examples of ER Diagram
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
123
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-
1 124
Topic- Generalization, Specialization and Aggregation
Objective
1. Generalization of Entities helps in establishing relationships between the
tables, as they have common attributes to be identified. It makes the
structuring of the database management simpler and easy to identify all the
relevant attributes.
2. Specialization helps in defining the set of subclasses of the entity type. Also,
it helps in establishing extra specific attributes with all subclasses and added
specific relationship types between each subclass and the other entity types
or the other subclasses.
3. Inheritance is an important feature of Generalization and Specialization.
It allows lower-level entities to inherit the attributes of higher-level entities.
For example, the attributes of a Person class such as name, age, and gender
can be inherited by lower-level entities such as Student or Teacher.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 125
Generalization
• Generalization is the process of extracting common properties from
a set of entities and create a generalized entity from it.
• It is a bottom-up approach in which two or more entities can be
generalized to a higher level entity if they have some attributes in
common.
• For Example, STUDENT and FACULTY can be generalized to a higher
level entity called PERSON as shown in Figure.
• In this case, common attributes like P_NAME, P_ADD become part
of higher entity (PERSON) and specialized attributes like S_FEE
become part of specialized entity (STUDENT).
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 126
Example:
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 127
Specialization
• In specialization, an entity is divided into sub-entities based on their
characteristics.
• It is a top-down approach where higher level entity is specialized
into two or more lower level entities.
• For Example, EMPLOYEE entity in an Employee management system
can be specialized into DEVELOPER, TESTER etc. as shown in Figure.
• In this case, common attributes like E_NAME, E_SAL etc. become
part of higher entity (EMPLOYEE) and specialized attributes like
TES_TYPE become part of specialized entity (TESTER).
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 128
Example:
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 129
Aggregation
• Aggregation refers to the process by which entities are
combined to form a single meaningful entity.
• The specific entities are combined because they do not make
sense on their own. To establish a single entity, aggregation
creates a relationship that combines these entities.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 130
Reduction of an ER diagrams to tables Objectives
1. Mapping an Entity Relationship (ER) model gives a good overview of
the design of a system with the goal of making the system easier to
understand at a technical level.
2. The ER diagrams can be mapped to a relation schema, which means
we can clearly display the relationship between its members.
3. An Entity Relationship (ER) Diagram is a type of flowchart
that illustrates how “entities” such as people, objects or concepts
relate to each other within a system.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 131
Reduction of an ER diagrams to tables
Rule-01: For Strong Entity Set With Only Simple Attributes
• A strong entity set with only simple attributes will require only one
table in relational model.
– Attributes of the table will be the attributes of the entity set.
– The primary key of the table will be the key attribute of the
entity set.
Schema : Student ( Roll_no , Name , Sex
)
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 132
RULE-02
Rule-02: For Strong Entity Set With Composite Attributes
• A strong entity set with any number of composite attributes will
require only one table in relational model.
• While conversion, simple attributes of the composite attributes are
taken into account and not the composite attribute itself.
Schema : Student ( Roll_no , First_name , Last_name , House_no , Street
, City )
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 133
RULE-03
Rule-03: For Strong Entity Set With Multi Valued Attributes
• A strong entity set with any number of multi valued attributes will
require two tables in relational model.
– One table will contain all the simple attributes with the primary
key.
– Other table will contain the primary key and all the multi valued
attributes.
•
Roll_no City Roll_no Mobile_no
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 134
RULE-04
Rule-04: Translating Relationship Set into a Table
• A relationship set will require one table in the relational model.
• Attributes of the table are-
– Primary key attributes of the participating entity sets
– Its own descriptive attributes if any.
– Set of non-descriptive attributes will be the primary key.
Schema : Works in ( Emp_no , Dept_id ,
experience )
exper
ience
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 135
RULE-05
Rule-05: For Binary Relationships With Cardinality Ratios
• The following four cases are possible-
– Case-01: Binary relationship with cardinality ratio m:n
– Case-02: Binary relationship with cardinality ratio 1:n
– Case-03: Binary relationship with cardinality ratio m:1
– Case-04: Binary relationship with cardinality ratio 1:1
•
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 136
RULE-05 (contd..)
Case-01: For Binary Relationship With Cardinality Ratio m:n
• Here, three tables will be required-
1. A ( a1 , a2 )
2. R ( a1 , b1 )
3. B ( b1 , b2 )
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 137
RULE-05 (contd..)
Case-02: For Binary Relationship With Cardinality Ratio 1:n
• Here, two tables will be required-
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
NOTE- Here, combined table will be drawn for the entity set B and
relationship set R.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 138
RULE-05 (contd..)
Case-03: For Binary Relationship With Cardinality Ratio m:1
• Here, two tables will be required-
1. AR ( a1 , a2 , b1 )
2. B ( b1 , b2 )
NOTE- Here, combined table will be drawn for the entity set A and
relationship set R.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 139
RULE-05 (contd..)
Case-04: For Binary Relationship With Cardinality Ratio 1:1
• Here, two tables will be required. Either combine ‘R’ with ‘A’ or ‘B’
• Way-01:
1. AR ( a1 , a2 , b1 )
2. B ( b1 , b2 )
• Way-02:
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 140
RULE-06
Rule-06: For Binary Relationship With Both Cardinality Constraints
and Participation Constraints-
• Case-01: For Binary Relationship With Cardinality Constraint and
Total Participation Constraint From One Side
• Case-02: For Binary Relationship With Cardinality Constraint and
Total Participation Constraint From Both Sides-
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 141
RULE-06 (contd..)
Case-01: For Binary Relationship With Cardinality Constraint and
Total Participation Constraint From One Side
• Because cardinality ratio = 1 : n , so we will combine the entity set B
and relationship set R.
• Then, two tables will be required-
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
• Because of total participation, foreign key a1 has acquired NOT
NULL constraint, so it can’t be null now.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 142
RULE-06 (contd..)
Case-02: For Binary Relationship With Cardinality Constraint and
Total Participation Constraint From Both Sides
• If there is a key constraint from both the sides of an entity set with
total participation, then that binary relationship is represented
using only single table.
• Here, Only one table is required.
1. ARB ( a1 , a2 , b1 , b2 )
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 143
RULE-07
Rule-07: For Binary Relationship With Weak Entity Set
• Weak entity set always appears in association with identifying
relationship with total participation constraint.
• Here, two tables will be required-
1. A ( a1 , a2 )
2. BR ( a1 , b1 , b2 )
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 144
Examples of ER Diagram
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 145
ER Diagram For Department
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 146
ER Diagram for Company
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 147
Summary of Conceptual Design
• Conceptual design follows requirements analysis,
– Yields a high-level description of data to be stored
• ER model popular for conceptual design
– Constructs are expressive, close to the way people think about
their applications.
• Basic constructs: entities, relationships, and attributes (of entities
and relationships).
• Some additional constructs: weak entities, ISA hierarchies, and
aggregation.
• Note: There are many variations on ER model.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 148
Summary of ER (Contd.)
• ER design is subjective. There are often many ways to model a
given scenario! Analyzing alternatives can be tricky, especially for a
large enterprise. Common choices include:
– Entity vs. attribute, entity vs. relationship, binary or n-ary
relationship, whether or not to use ISA hierarchies, and whether
or not to use aggregation.
• Ensuring good database design: resulting relational schema should
be analyzed and refined further. FD information and normalization
techniques are especially useful.
• Define Database System.
• What do you understand by data independence?
• Explain types of attributes in ER diagram.
• What is generalization.
• What do you understand by primary key?
• Explain participation cardinality.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 149
Daily Quiz
• Define: Data, Database, and Database System.
• What is data independence? What are differences between Logical
Data Independence and Physical Data Independence?
• Give example of Simple, Composite, Single –valued and Multi-
valued attributes of an entity.
• What is the difference between Generalization & Specialization
with respect to Database?
• What is difference between total and partial participation? Explain
by suitable example.
• Construct an E-R diagram for a hospital with a set of patients and a
set of medical doctors. Associated with each patient, a log of the
various tests and examinations conducted.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 150
Weekly Assignment
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 151
Topic Links
1. https://www.geeksforgeeks.org/last-minute-notes-dbms/
2. https://www.geeksforgeeks.org/quiz-corner-gq/#DBMS%20Mock%20Tests
3. https://www.geeksforgeeks.org/commonly-asked-dbms-interview-
questions/
4. https://www.geeksforgeeks.org/commonly-asked-dbms-interview-
questions-set-2/
• The entity relationship set is represented in E-R diagram as
a) Double diamonds
b) Undivided rectangles
c) Dashed lines
d) Diamond
• The Rectangles divided into two parts represents
a) Entity set
b) Relationship set
c) Attributes of a relationship set
d) Primary key
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 152
MCQ s
• An entity set that does not have sufficient attributes to form a
primary key is termed a __________
a) Strong entity set
b) Variant set
c) Weak entity set
d) Variable set
• What term is used to refer to a specific record in your music
database; for instance; information stored about a specific album?
a) Relation
b) Instance
c) Table
d) Column
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 153
MCQ s
• Which of the following is generally used for performing tasks like creating the
structure of the relations, deleting relation?
DML(Data Manipulation Language)
Query
Relational Schema
DDL(Data Definition Language)
• Which of the following provides the ability to query information from the database
and insert tuples into, delete tuples from, and modify tuples in the database?
DML(Data Manipulation Language)
DDL(Data Definition Language)
Query
Relational Schema
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
154
MCQ s
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 155
Glossary Questions
1. Attempt all the parts. Pick the correct option from glossary. [CO1]
(i) Double diamonds (ii) Database Management System (iii) Diamond (iv) Entity set
(a). _____________is the full form of DBMS.
(b). A weak relationship is represented in E-R diagram as___________.
(c) The Rectangles in E-R diagram represents____________________.
(d). The relationship is represented in E-R diagram as_____________.
2. Attempt all the parts. Pick the correct option from glossary. [CO1]
(i ) FALSE (ii) TRUE (iii) Tuple (iv) Meta Data
(a) A row of a relation is known as____________.
(b)_____________________refers to the "data about data"?
(c) Alternate Key is a kind of partial key in DBMS, which is created when you don’t have any
natural primary key._______
(d) Generalization is a bottom-up approach.______
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Sessional Paper-1
4/23/2024 156
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 157
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 158
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Sessional Paper-2
4/23/2024 159
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 160
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 161
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
162
Old University Question Paper
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 163
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 164
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 165
4/23/2024
Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
166
Old University Question Paper
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 167
Shabnam Firdaus ACSAI-0402 -DBMS
Unit-1
Conti….
4/23/2024 168
• http://www.aktuonline.com/papers/btech-cs-5-sem-data-base-
management-system-KCS501-2020.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-
management-system-KCS-501-2018-19.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-
management-system-ncs-502-2017-18.pdf
• http://www.aktuonline.com/papers/btech-cs-5-sem-database-
management-system-ncs-502-2016-17.pdf
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 169
Old Question Papers
• Explain types of attributes in ER diagram.
• Explain the difference between a weak and a strong entity set with
example.
• Discuss three level of abstractions or schemas architecture of
DBMS.
• Define constraint and its types in DBMS.
• Compare Generalization, Specialization and aggregation with
suitable examples.
• Draw overall structure of DBMS and explain its components in brief.
• Construct an E-R diagram for a hospital with a set of patients and a
set of medical doctors. Associated with each patient, a log of the
various tests and examinations conducted.
•
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 170
Expected Questions for University Exam
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 171
Recap of Unit
• Knowledge of database architecture.
• Knowledge of Entity Relationship model and its concepts.
• Databse V/S File system.
4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 172

More Related Content

Similar to DBMS UNIT -1.pptx unit 1 ppt niet 4 year

Presentation on po pshjhhjhekhhkkhkhjpeo
Presentation on po pshjhhjhekhhkkhkhjpeoPresentation on po pshjhhjhekhhkkhkhjpeo
Presentation on po pshjhhjhekhhkkhkhjpeo
epandhari
 
B tech-mechanical second-third-yr-13.5.2019-1(1)
B tech-mechanical second-third-yr-13.5.2019-1(1)B tech-mechanical second-third-yr-13.5.2019-1(1)
B tech-mechanical second-third-yr-13.5.2019-1(1)
Nikhil Pai
 
Student manual CSBS (2).pdf for operating systems lab
Student manual CSBS (2).pdf for operating systems labStudent manual CSBS (2).pdf for operating systems lab
Student manual CSBS (2).pdf for operating systems lab
BalamuruganV28
 
COA RKGITM #sem education purpose ppt good for student
COA RKGITM #sem education purpose ppt good for studentCOA RKGITM #sem education purpose ppt good for student
COA RKGITM #sem education purpose ppt good for student
mohitmehra75
 

Similar to DBMS UNIT -1.pptx unit 1 ppt niet 4 year (20)

Presentation on po pshjhhjhekhhkkhkhjpeo
Presentation on po pshjhhjhekhhkkhkhjpeoPresentation on po pshjhhjhekhhkkhkhjpeo
Presentation on po pshjhhjhekhhkkhkhjpeo
 
B Tech Civil Engineering Syllabus at MITAOE
B Tech Civil Engineering Syllabus at MITAOEB Tech Civil Engineering Syllabus at MITAOE
B Tech Civil Engineering Syllabus at MITAOE
 
Biology for Engineers Course plan new 30.06.20
Biology for Engineers Course plan new 30.06.20Biology for Engineers Course plan new 30.06.20
Biology for Engineers Course plan new 30.06.20
 
B tech-mechanical second-third-yr-13.5.2019-1(1)
B tech-mechanical second-third-yr-13.5.2019-1(1)B tech-mechanical second-third-yr-13.5.2019-1(1)
B tech-mechanical second-third-yr-13.5.2019-1(1)
 
Student manual CSBS (2).pdf for operating systems lab
Student manual CSBS (2).pdf for operating systems labStudent manual CSBS (2).pdf for operating systems lab
Student manual CSBS (2).pdf for operating systems lab
 
Fetch
FetchFetch
Fetch
 
SE LAB MANUAL (R16).pdf
SE LAB MANUAL (R16).pdfSE LAB MANUAL (R16).pdf
SE LAB MANUAL (R16).pdf
 
Electronic engineering syllabus at mitaoe
Electronic engineering syllabus at mitaoeElectronic engineering syllabus at mitaoe
Electronic engineering syllabus at mitaoe
 
AI_LAB_Manual in c with all the programs
AI_LAB_Manual in c with all the programsAI_LAB_Manual in c with all the programs
AI_LAB_Manual in c with all the programs
 
Introductory PPT CSC202 SECURITY ARCHITECTURE.pptx
Introductory PPT CSC202 SECURITY ARCHITECTURE.pptxIntroductory PPT CSC202 SECURITY ARCHITECTURE.pptx
Introductory PPT CSC202 SECURITY ARCHITECTURE.pptx
 
COA RKGITM #sem education purpose ppt good for student
COA RKGITM #sem education purpose ppt good for studentCOA RKGITM #sem education purpose ppt good for student
COA RKGITM #sem education purpose ppt good for student
 
M.Sc.Syllabus 17 Nov 2022 (1).pdf
M.Sc.Syllabus 17 Nov 2022 (1).pdfM.Sc.Syllabus 17 Nov 2022 (1).pdf
M.Sc.Syllabus 17 Nov 2022 (1).pdf
 
ST4211_NUMERICAL-AND-INITE-ELEMENT-ANALYSIS-LABORATORY.pdf
ST4211_NUMERICAL-AND-INITE-ELEMENT-ANALYSIS-LABORATORY.pdfST4211_NUMERICAL-AND-INITE-ELEMENT-ANALYSIS-LABORATORY.pdf
ST4211_NUMERICAL-AND-INITE-ELEMENT-ANALYSIS-LABORATORY.pdf
 
Cloud_Storage
Cloud_Storage Cloud_Storage
Cloud_Storage
 
Chemical engineering syllabus - mitaoe
Chemical engineering syllabus - mitaoeChemical engineering syllabus - mitaoe
Chemical engineering syllabus - mitaoe
 
OOAD & ST LAB MANUAL.pdfOose feasibility study in detail Oose feasibility stu...
OOAD & ST LAB MANUAL.pdfOose feasibility study in detail Oose feasibility stu...OOAD & ST LAB MANUAL.pdfOose feasibility study in detail Oose feasibility stu...
OOAD & ST LAB MANUAL.pdfOose feasibility study in detail Oose feasibility stu...
 
nba ppt for inspection.pptx
nba ppt for inspection.pptxnba ppt for inspection.pptx
nba ppt for inspection.pptx
 
ST4212-STRUCTURAL DESIGN STUDIO LABORATORY.pdf
ST4212-STRUCTURAL DESIGN STUDIO LABORATORY.pdfST4212-STRUCTURAL DESIGN STUDIO LABORATORY.pdf
ST4212-STRUCTURAL DESIGN STUDIO LABORATORY.pdf
 
B.Tech.AIDS syllabus anna university .pdf
B.Tech.AIDS syllabus anna university .pdfB.Tech.AIDS syllabus anna university .pdf
B.Tech.AIDS syllabus anna university .pdf
 
B.Tech.AIDS 2017 regulation annauniversity .pdf
B.Tech.AIDS 2017 regulation annauniversity .pdfB.Tech.AIDS 2017 regulation annauniversity .pdf
B.Tech.AIDS 2017 regulation annauniversity .pdf
 

Recently uploaded

NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
Amil baba
 
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
fztigerwe
 
一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理
cyebo
 
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotecAbortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
ppy8zfkfm
 
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Valters Lauzums
 
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
pyhepag
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
pwgnohujw
 
一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理
cyebo
 
一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理
pyhepag
 

Recently uploaded (20)

NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
 
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
 
一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理
 
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
Data Visualization Exploring and Explaining with Data 1st Edition by Camm sol...
 
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
 
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotecAbortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
 
Digital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
Digital Marketing Demystified: Expert Tips from Samantha Rae CoolbethDigital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
Digital Marketing Demystified: Expert Tips from Samantha Rae Coolbeth
 
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
 
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
 
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
一比一原版加利福尼亚大学尔湾分校毕业证成绩单如何办理
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
 
社内勉強会資料  Mamba - A new era or ephemeral
社内勉強会資料   Mamba - A new era or ephemeral社内勉強会資料   Mamba - A new era or ephemeral
社内勉強会資料  Mamba - A new era or ephemeral
 
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdfFormulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdf
 
Bios of leading Astrologers & Researchers
Bios of leading Astrologers & ResearchersBios of leading Astrologers & Researchers
Bios of leading Astrologers & Researchers
 
一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理
 
2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting
 
Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)
 
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...
 
一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理
 
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
MATERI  MANAJEMEN OF PENYAKIT TETANUS.pptMATERI  MANAJEMEN OF PENYAKIT TETANUS.ppt
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
 

DBMS UNIT -1.pptx unit 1 ppt niet 4 year

  • 1. Noida Institute of Engineering and Technology, Greater Noida Introduction Shabnam Firdaus Assistant Professor (AI) 4/23/2024 1 Unit: 1 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 DBMS ACSAI0402 Course Details (B Tech IVth Sem)
  • 2. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 2 Name: Shabnam Firdaus Qualification: B.Tech(IT), M.Tech (IT) Area of Research: Machine Learning, Artificial Intelligence Contact Details: Email: shabnam.firdaus@niet.co.in Brief Introduction of Faculty member
  • 3. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 3 Evaluation Scheme
  • 4. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 4 Subject Syllabus
  • 5. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 5 Subject Syllabus
  • 6. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 6 Branch wise Applications 1.AI - Apache Cassandra is an open-source and highly scalable NoSQL database management system that is designed to manage massive amounts of data in a faster manner. This popular database is being used by GitHub, Netflix, Instagram, Reddit, among others. 2. IoT - IoT devices' primary purpose is often to collect and/or generate data and share it for some higher purpose such as analytics, machine learning and artificial intelligence. Consequently, IoT DBMSs need to manage not just data at rest, but also data in transit. 3. CS – There are various application of dbms in different fields like Railway Reservation System, Library Management System, Banking, Universities and colleges, Credit card transactions etc
  • 7. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 7 Course Objective • The objective of course is to present an introduction to database management systems, with an emphasis on how to organize, maintain and retrieve-efficiently, and effectively –information in relational and non-relational Database. • List and explain the fundamental concepts of a relational database system • Knowledge of DBMS, both in terms of use and implementation/design. • Experience with SQL and Manipulate a database using SQL • Increased proficiency with the programming language C++. • Experience working as part of team v Experience with analysis and design of (DB) software • Assess the quality and ease of use of data modeling and diagramming tools.
  • 8. 8 Course Outcomes (COs) 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
  • 9. 4/23/2024 9 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Engineering Graduates will be able to: 1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and an engineering specialization to the solution of complex engineering problems. 2. Problem analysis: Identify, formulate, review research literature, and analyze complex engineering problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and engineering sciences. 3. Design/development of solutions: Design solutions for complex engineering problems and design system components or processes that meet the specified needs with appropriate consideration for the public health and safety, and the cultural, societal, and environmental considerations. 4. Conduct investigations of complex problems: Use research-based knowledge and research methods including design of experiments, analysis and interpretation of data, and synthesis of the information to provide valid conclusions. Program Outcomes (POs)
  • 10. 4/23/2024 10 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering and IT tools including prediction and modeling to complex engineering activities with an understanding of the limitations. 6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional engineering practice. 7. Environment and sustainability: Understand the impact of the professional engineering solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable development. 8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the engineering practice. Contd.. Program Outcomes (POs)
  • 11. 4/23/2024 11 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse teams, and in multidisciplinary settings. 10. Communication: Communicate effectively on complex engineering activities with the engineering community and with society at large, such as, being able to comprehend and write effective reports and design documentation, make effective presentations, and give and receive clear instructions. 11. Project management and finance: Demonstrate knowledge and understanding of the engineering and management principles and apply these to one’s own work, as a member and leader in a team, to manage projects and in multidisciplinary environments. 12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in independent and life-long learning in the broadest context of technological change. Contd.. Program Outcomes (POs)
  • 12. PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 ASCAI0402.1 2 2 3 3 3 2 3 2 2 2 2 3 ACSAI0402.2 3 3 3 2 2 2 2 2 2 2 2 3 ACSAI0402.3 2 3 3 3 3 2 2 2 2 2 2 2 ACSAI0402.4 2 3 2 2 2 2 2 2 2 3 2 2 ACSAI0402.5 2 3 2 2 2 3 2 2 3 2 2 2 AVG 2.20 2.80 2.60 2.40 2.40 2.20 2.20 2.00 2.20 2.20 2.00 2.40 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 12 COs and POs Mapping
  • 13. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 13 Program Specific Outcomes (PSOs) On successful completion of graduation degree the Engineering graduates will be able to: PSO1: The ability to identify, analyze real world problems and design their ethical solutions using artificial intelligence, robotics, virtual/augmented reality, data analytics, block chain technology, and cloud computing. PSO2:The ability to design and develop the hardware sensor devices and related interfacing software systems for solving complex engineering problems. PSO3:The ability to understand inter disciplinary computing techniques and to apply them in the design of advanced computing. PSO4: The ability to conduct investigation of complex problem with the help of technical, managerial, leadership qualities, and moder engineering tools provided by industry sponsored laboratories.
  • 14. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 14 COs and PSOs Mapping Program Specific Outcomes PSO1 PSO2 PSO3 PSO4 ACSAI0402.1 3 1 3 1 ACSAI0402.2 3 1 3 1 ACSAI0402.3 3 1 3 1 ACSAI0402.4 3 1 3 1 ACSAI0402.5 3 1 3 1 AVG 3.00 1.00 3.00 1.00
  • 15. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 15 Program Educational Objectives (PEOs) PEO1: To have an excellent scientific and engineering breadth so as to comprehend, analyze, design and provide sustainable solutions for real-life problems using state-of- the-art technologies. PEO2:To have a successful career in industries, to pursue higher studies or to support entrepreneurial endeavors and to face global challenges. PEO3:To have an effective communication skills, professional attitude, ethical values and a desire to learn specific knowledge in emerging trends, technologies for research, innovation and product development and contribution to society. PEO4: To have life-long learning for up-skilling and re-skilling for successful professional career as engineer, scientist, entrepreneur and bureaucrat for betterment of society
  • 16. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 16 COs and PSOs Mapping Program Specific Outcomes PSO1 PSO2 PSO3 PSO4 ACSAI0402.1 3 1 3 1 ACSAI0402.2 3 1 3 1 ACSAI0402.3 3 1 3 1 ACSAI0402.4 3 1 3 1 ACSAI0402.5 3 1 3 1 AVG 3.00 1.00 3.00 1.00
  • 17. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 17 Result Analysis
  • 18. 18 Question Paper Template 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1
  • 19. 19 Question Paper Template 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 SECTION – A CO 1. Attempt all parts- [10×1=10] 1-a. Question- (1) 1-b. Question- (1) 1-c. Question- (1) 1-d. Question- (1) 1-e. Question- (1) 1-f. Question- (1) 1-g. Question- (1) 1-h. Question- (1) 1-i. Question- (1) 1-j. Question- (1) 2. Attempt all parts- [5×2=10] CO 2-a. Question- (2) 2-b. Question- (2) 2-c. Question- (2) 2-d. Question- (2) 2-e. Question- (2) SECTION – B CO 3. Answer any five of the following- [5×6=30] 3-a. Question- (6) 3-b. Question- (6) 3-c. Question- (6) 3-d. Question- (6) 3-e. Question- (6) 3-f. Question- (6) 3-g. Question- (6) SECTION – C CO 4 Answer any one of the following- [5×10=50] 4-a. Question- (10) 4-b. Question- (10) 5. Answer any one of the following- 5-a. Question- (10) 5-b. Question- (10) 6. Answer any one of the following- 6-a. Question- (10) 6-b. Question- (10) 7. Answer any one of the following- 7-a. Question- (10) 7-b. Question- (10) 8. Answer any one of the following- 8-a. Question- (10) 8-b. Question- (10)
  • 20. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 20 Prerequisite and Recap • There is No prerequisite for learning DBMS from scratch although having basic knowledge of discrete mathematics and data structure is added advantage. • Having knowledge of basic mathematics like - SUM, DIFFERENCE, AVERAGE, MEAN, MEDIAN, MODE, etc will definitely be a plus point. • Having knowledge on Set Theory will help. • The proper understanding of data structures (B and B+ trees) will help you to understand the DBMS quickly.
  • 21. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 21 Brief Introduction about the Subject with videos 1. A database management system (DBMS) refers to the technology for creating and managing databases. DBMS is a software tool to organize (create, retrieve, update, and manage) data in a database. 2. The main aim of a DBMS is to supply a way to store up and retrieve database information that is both convenient and efficient. By data, we mean known facts that can be recorded and that have embedded meaning. (15) 22 - DBMS - I – YouTube (15) Lec 1: Introduction to DBMS | Database Management System – YouTube (15) Introduction to SQL | DDL, DML, DQL, DCL, TCL Commands in SQL - YouTube (15) NoSQL Tutorial for Beginners | Introduction to NoSQL Databases | NoSQL Databases Tutorial – YouTube
  • 22. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 22 Content – Unit 1 • Introduction: An overview of database management system, database system Vs file system, Database system concept and architecture, data model schema and instances, data independence and database language and interfaces, data definitions language, DML. • Data Modeling using the Entity Relationship Model: ER model concepts, notation for ER diagram, mapping constraints, keys, Concepts of Super Key, candidate key, primary key, Generalization, aggregation, reduction of an ER diagrams to tables, extended ER model, relationship of higher degree.
  • 23. 4/23/2024 23 Unit Objective Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 1. The main objectives of database management system are data availability, data integrity, data security, and data independence. 2. DDL stands for Data Definition Language. DML stands for Data Manipulation Language. DDL statements are used to create database, schema, constraints, users, tables etc. DML statement is used to insert, update or delete the records. 3. ER diagrams are used to analyze existing databases to find and resolve problems in logic or deployment. Drawing the diagram should reveal where it's going wrong. Business information systems: The diagrams are used to design or analyze relational databases used in business processes.
  • 24. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 24 Topic mapping with CO Topic CO Database system Vs File system CO1 Database system concepts, CO1 architecture and structures CO1 data model schema and instances CO1 Data independence and Database language and Interfaces CO1 Data Modeling using the Entity Relationship Model CO1 ER model concepts CO1 notation for ER diagram CO1 mapping constraints CO1 keys CO1 Concepts of Super Key CO1
  • 25. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 25 Topic mapping with CO Topic CO Candidate key CO1 Primary key CO1 Generalization, Aggregation CO1 Reduction of an ER diagrams to tables CO1 Extended ER model CO1 Relationship of higher degree. CO1
  • 26. Lecture 1 • Why we use DBMS • File vs DBMS • Purpose of Database system 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 26
  • 27. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 27 Topic – DBMS Objective The main objectives of database management system are data availability, data integrity, data security, and data independence.
  • 28. • A very large, integrated collection of related data. • Models real-world enterprise. – Entities (e.g., students, courses) – Relationships (e.g., Madonna is taking CS564) • A Database Management System (DBMS) is a software package designed to define,construct and manipulate database. • Database + Database Management System= Database System. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 28 What is a DBMS? (CO1)
  • 29. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 29 Why Use a DBMS? • Data independence and efficient access. • Reduced application development time. • Data integrity and security. • Uniform data administration. • Concurrent access, recovery from crashes.
  • 30. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 30 Why Study Databases?  Shift from computation to information  at the “low end”: scramble to webspace (a mess!)  at the “high end”: scientific applications  Datasets increasing in diversity and volume.  Digital libraries, interactive video, Human Genome project, EOS project  ... need for DBMS exploding  DBMS encompasses most of CS  OS, languages, theory, AI, multimedia, logic
  • 31. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 31 Files vs. DBMS • The file system is basically a way of arranging the files in a storage medium like a hard disk. • The file system organizes the files and helps in the retrieval of files when they are required. • File systems consist of different files which are grouped into directories. • The directories further contain other folders and files. The file system performs basic operations like management, file naming, giving access rules, etc. • Example: NTFS(New Technology File System), EXT(Extended File System).
  • 32. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 32 Files vs. DBMS Basis File System DBMS Structure The file system is software that manages and organizes the files in a storage medium within a computer. DBMS is software for managing the database. Data Redundancy Redundant data can be present in a file system. In DBMS there is no redundant data. Backup and Recovery It doesn’t provide backup and recovery of data if it is lost. It provides backup and recovery of data even if it is lost. Query processing There is no efficient query processing in the file system. Efficient query processing is there in DBMS. Consistency There is less data consistency in the file system. There is more data consistency because of the process of normalization. Complexity It is less complex as compared to DBMS. It has more complexity in handling as compared to the file system.
  • 33. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 33 Files vs. DBMS Security Constraints File systems provide less security in comparison to DBMS. DBMS has more security mechanisms as compared to file systems. Cost It is less expensive than DBMS. It has a comparatively higher cost than a file system. Data Independence There is no data independence. In DBMS data independence exists. User Access Only one user can access data at a time. Multiple users can access data at a time. Meaning The user has to write procedures for managing databases The user not required to write procedures. Sharing Data is distributed in many files. So, not easy to share data Due to centralized nature sharing is easy Data Abstraction It give details of storage and representation of data It hides the internal details of Database Integrity Constraints Integrity Constraints are difficult to implement Integrity constraints are easy to implement Example Cobol, C++ Oracle, SQL Server
  • 34. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 34 Purpose of Database Systems  In the early days, database applications were built directly on top of file systems  Drawbacks of using file systems to store data:  Data redundancy and inconsistency  Multiple file formats, duplication of information in different files  Difficulty in accessing data  Need to write a new program to carry out each new task  Data isolation — multiple files and formats  Integrity problems  Integrity constraints (e.g. account balance > 0) become “buried” in program code rather than being stated explicitly  Hard to add new constraints or change existing ones
  • 35. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 35 Purpose of Database Systems (Cont.) • Drawbacks of using file systems (cont.) – Atomicity of updates • Failures may leave database in an inconsistent state with partial updates carried out • Example: Transfer of funds from one account to another should either complete or not happen at all – Concurrent access by multiple users • Concurrent access needed for performance • Uncontrolled concurrent accesses can lead to inconsistencies – Example: Two people reading a balance and updating it at the same time – Security problems • Hard to provide user access to some, but not all, data • Database systems offer solutions to all the above problems
  • 36. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 36 Summary • DBMS used to maintain, query large datasets. • Benefits include recovery from system crashes, concurrent access, quick application development, data integrity and security. • Levels of abstraction give data independence. • A DBMS typically has a layered architecture. • DBAs hold responsible jobs and are well-paid! • DBMS R&D is one of the broadest, most exciting areas in CS.
  • 37. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 37 Short Quiz 1. Which of the following is a NoSQL Database Type? a) SQL b) Database Management System c) Database Management Service d) Data Backup Management System 2. What is a database? a) Organized collection of information that cannot be accessed, updated, and managed b) Collection of data or information without organizing c) Organized collection of data or information that can be accessed, updated, and managed d) Organized collection of data that cannot be updated
  • 38. Lecture 2 • Data Models • Database Arcitecture • Schema and instances • Levels of Abstraction • Data Independence 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 38
  • 39. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 39 Topic – Data models Objective 1. Data Model gives us an idea that how the final system will look like after its complete implementation. 2. It defines the data elements and the relationships between the data elements. 3. Data Models are used to show how data is stored, connected, accessed and updated in the database management system.
  • 40. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 40 Data Models • Data models define how the logical structure of a database is modeled. • Data models define how data is connected to each other and how they are processed and stored inside the system.
  • 41. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 41 Data Models 1) Relational Data Model: This type of model designs the data in the form of rows and columns within a table. Thus, a relational model uses tables for representing data and in-between relationships. Tables are also called relations. 2) Entity-Relationship Data Model: An ER model is the logical representation of data as objects and relationships among them. These objects are known as entities, and relationship is an association among these entities. 3) Object-based Data Model: An extension of the ER model with notions of functions, encapsulation, and object identity, as well. This model supports a rich type system that includes structured and collection types. Both the data and the relationship are contained in a single structure that is known as an object in this model. We can now store audio, video, pictures, and other types of data in databases, which was previously impossible with the relational approach
  • 42. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 42 Data Models 4) Semistructured Data Model: This type of data model is different from the other three data models (explained above). The semistructured data model allows the data specifications at places where the individual data items of the same type may have different attributes sets. 5)Hierarchical Model: This concept uses a hierarchical tree structure to organise the data. The hierarchy begins at the root, which contains root data, and then grows into a tree as child nodes are added to the parent node. 6) Network Model : The main difference between this model and the hierarchical model is that any record can have several parents in the network model. It uses a graph instead of a hierarchical tree.
  • 43. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 43 DBMS Architecture • Two-tier architecture: The two-tier architecture is similar to a basic client- server model. • The application at the client end directly communicates with the database at the server side using API. • (Application Programming Interface (API) is a software interface that allows two applications to interact with each other without any user intervention. API is a collection of software functions and procedures. In simple terms, API means a software code that can be accessed or executed. API is defined as a code that helps two different software’s to communicate and data with each other.)
  • 44. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 44 DBMS Architecture • The server side is responsible for providing query processing and transaction management functionalities. • On the client side, the user interfaces and application programs are run. The application on the client side establishes a connection with the server side in order to communicate with the DBMS. An advantage of this type is that maintenance and understanding are easier, and compatible with existing systems. However, this model gives poor performance when there are a large number of users.
  • 45. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 45 DBMS Architecture
  • 46. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 46 DBMS Architecture • The main disadvantages of Two-Tier DBMS Architecture are: • Scalability - As the number of clients increases, the load on the server increases. Thereby declining the performance of the DBMS and, in turn, the client-side application. • Security - The Direct connection between the client and server systems makes this architecture vulnerable to attacks.
  • 47. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 47 DBMS Architecture • Three Tier architecture: In this type, there is another layer between the client and the server. • The client does not directly communicate with the server. Instead, it interacts with an application server which further communicates with the database system and then the query processing and transaction management takes place. • This intermediate layer acts as a medium for the exchange of partially processed data between server and client. • This type of architecture is used in the case of large web applications.
  • 48. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 48 DBMS Architecture A 3-tier architecture has the following layers: 1. Presentation layer (your PC, Tablet, Mobile, etc.) 2. Application layer (server) 3. Database Server
  • 49. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 49 DBMS Architecture • The main advantages of Three Tier DBMS Architecture are: • Scalability - Since the database server isn't aware of any users beyond the application layer and the application layer implements load balancing, there can be as many clients as you want. • Data Integrity - Data corruption and bad requests can be avoided because of the checks performed in the application layer on each client reques. • Security - The removal of the direct connection between the client and server systems via abstraction reduces unauthorized
  • 50. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 50 Schemas and Instances • Similar to types and variables in programming languages • Schema – the logical structure of the database – Example: The database consists of information about a set of customers and accounts and the relationship between them – Analogous to type information of a variable in a program • Instance – the actual content of the database at a particular point in time – Analogous to the value of a variable
  • 51. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 51 Schemas and Instances • What is a Schema? • It refers to an overall description that we get for any given database. In simpler words, schema refers to the basic structure of how one needs to store data in any database. There are basically two types of Schema: Physical Schema and Logical Schema. • Physical Schema – This schema describes the DB designed at a physical level. • Logical Schema – This schema describes the DB designed at a logical level.
  • 52. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 52 Schemas and Instances • Example: Let’s say a table teacher in our database name school, the teacher table require the name, dob, doj in their table so we design a structure as
  • 53. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 53 •Physical Database Schema − This schema pertains to the actual storage of data and its form of storage like files, indices, etc. It defines how the data will be stored in a secondary storage. •Logical Database Schema − This schema defines all the logical constraints that need to be applied on the data stored. It defines tables, views, and integrity constraints. Schemas and Instances
  • 54. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 54 Schemas and Instances • What are Instances? • These refer to a collection of all the information and data stored at any given moment. • One can easily change these instances using certain operations, such as deletion and addition of data and information. • Example : Let’s say a table teacher in our database whose name is School, suppose the table has 50 records so the instance of the database has 50 records for now and tomorrow we are going to add another fifty records so tomorrow the instance have total 100 records. This is called an instance.
  • 55. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 55 Schemas and Instances Parameters Schema in DBMS Instance in DBMS Meaning Schema refers to the overall description of any given database. Instance basically refers to a collection of data and information that the database stores at any particular moment. Alterations The schema remains the same for the entire database as a whole. One can change the instances of data and information in a database using updation, deletion, and addition. Frequency of Change It does not change very frequently. It changes very frequently. Uses We use Schema for defining the basic structure of any given database. It defines how the available needs to get stored. We use Instance for referring to a set of information at any given instance/ time.
  • 56. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 56 Levels of Abstraction • Physical Schema/Level: describes how a record (e.g., customer) is stored. • Logical Schema/Level: describes data stored in database, and the relationships among the data. type customer = record customer_id : string; customer_name : string; customer_street : string; customer_city : string; end; • External Schema/Level: application programs hide details of data types. Views can also hide information (such as an employee’s salary) for security purposes.
  • 57. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 57 Data Abstraction • Data Abstraction is a process of hiding unwanted or irrelevant details from the end user. It provides a different view and helps in achieving data independence which is used to enhance the security of data. • The database systems consist of complicated data structures and relations. For users to access the data easily, these complications are kept hidden, and only the relevant part of the database is made accessible to the users through data abstraction.
  • 58. • Three Schema Architecture for a Database System 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 58 Three schema Architecture
  • 59. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 59 Three schema Architecture
  • 60. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 60 Three schema Architecture • Objectives of Three schema Architecture • The main objective of three level architecture is to enable multiple users to access the same data with a personalized view while storing the underlying data only once. • Different users need different views of the same data. • The approach in which a particular user needs to see the data may change over time. • The users of the database should not worry about the physical implementation and internal workings of the database such as data compression and encryption techniques, hashing, optimization of the internal structures etc. • All users should be able to access the same data according to their requirements. • DBA should be able to change the conceptual structure of the database without affecting the user's • Internal structure of the database should be unaffected by changes to physical aspects of the storage.
  • 61. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 61 Three schema Architecture Conceptual Schema • The conceptual schema describes the design of a database at the conceptual level. Conceptual level is also known as logical level. • The conceptual schema describes the structure of the whole database. • The conceptual level describes what data are to be stored in the database and also describes what relationship exists among those data. • In the conceptual level, internal details such as an implementation of the data structure are hidden. • Programmers and database administrators work at this level.
  • 62. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 62 Three schema Architecture View Layer • Each view schema describes the database part that a particular user group is interested and hides the remaining database from that user group. • The view schema describes the end user interaction with database systems. • It also simplifies interaction with the user and it provides many views or multiple views of the same database.
  • 63. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 63 Example: University Database  Physical schema:  Relations stored as unordered files.  Index on first column of Students.  Conceptual schema:  Students(sid: string, name: string, login: string, age: integer, gpa:real)  Courses(cid: string, cname:string, credits:integer)  Enrolled(sid:string, cid:string, grade:string)  External Schema (View):  View1- Course_info(cid:string,enrollment:integer)  View2-studeninfo(id:int. name:string)
  • 64. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 64 Data Independence • Data Independence is defined as a property of DBMS that helps you to change the Database schema at one level of a database system without requiring to change the schema at the next higher level. • Data independence helps you to keep data separated from all programs that make use of it. • We know the main purpose of the three levels of data abstraction is to achieve data independence. If the database changes and expands over time, it is very important that the changes in one level should not affect the data at other levels of the database. This would save time and cost required when changing the database. • There are two levels of data independence based on three levels of abstraction. These are as follows − • Physical Data Independence • Logical Data Independence  One of the most important benefits of using a DBMS!
  • 65. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 65 Data Independence
  • 66. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 66 Physical Data Independence • Physical data independence can be defined as the capacity to change the internal schema without having to change the conceptual schema. • If we do any changes in the storage size of the database system server, then the Conceptual structure of the database will not be affected. • Physical data independence is used to separate conceptual levels from the internal levels. • Physical data independence occurs at the logical interface level.
  • 67. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 67 Physical Data Independence (contd..) • Due to Physical independence, any of the below change will not affect the conceptual layer. – Using a new storage device like Hard Drive or Magnetic Tapes – Modifying the file organization technique in the Database – Switching to different data structures. – Changing the access method. – Modifying indexes. – Changes to compression techniques or hashing algorithms. – Change of Location of Database from say C drive to D Drive
  • 68. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 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 independence refers characteristic of being able to change the conceptual schema without having to change the external schema. • 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.
  • 69. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 69 Logical Data Independence (contd..) • Due to Logical independence, any of the below change will not affect the external layer. – Add/Modify/Delete a new attribute, entity or relationship is possible without a rewrite of existing application programs – Merging two records into one – Breaking an existing record into two or more records
  • 70. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 70 Short Quiz 1. Which of the following is known as a set of entities of the same type that share same properties, or attributes? a) Relation set b) Tuples c) Entity set d) Entity Relation model 2. The values appearing in given attributes of any tuple in the referencing relation must likewise occur in specified attributes of at least one tuple in the referenced relation, according to _____________________ integrity constraint. a) Referential b) Primary c) Referencing d) Specific
  • 71. Lecture 3 • DATA BASE LANGUAGES • Data Definition Language (DDL) • Data Manipulation Language • Data Control Language • Transaction Control Language (TCL) 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 71
  • 72. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 72 DATA BASE LANGUAGE (CO1) • A DBMS has appropriate languages and interfaces to express database queries and updates. • Database languages can be used to read, store and update the data in the database. • Two classes of languages – Procedural – user specifies what data is required and how to get those data – Declarative (nonprocedural) – user specifies what data is required without specifying how to get those data • SQL is the most widely used query language
  • 73. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 73 Topic- Database Language Objective 1. DDL stands for Data Definition Language. DML stands for Data Manipulation Language. DDL statements are used to create database, schema, constraints, users, tables etc. DML statement is used to insert, update or delete the records. 2. DCL (Data Control Language) includes commands like GRANT and REVOKE, which are useful to give “rights & permissions.” 3. Transaction control language or TCL commands deal with the transaction within the database. 4. Data Query Language (DQL) is used to fetch the data from the database.
  • 74. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 74 DATA BASE LANGUAGE
  • 75. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 75 Data Definition Language (DDL) • DDL stands for Data Definition Language. It is used to define database structure or pattern. • It is used to create schema, tables, indexes, constraints, etc. in the database. • Using the DDL statements, you can create the skeleton of the database. • Data definition language is used to store the information of metadata like the number of tables and schemas, their names, indexes, columns in each table, constraints, etc.
  • 76. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 76 Data Definition Language (DDL) • Here are some tasks that come under DDL: – Create: It is used to create objects in the database. – Alter: It is used to alter the structure of the database. – Drop: It is used to delete objects from the database. – Truncate: It is used to remove all records from a table. – Rename: It is used to rename an object. – Comment: It is used to comment on the data dictionary. These commands are used to update the database schema that's why they come under Data definition language.
  • 77. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 77 Data Manipulation Language (DML) • DML stands for Data Manipulation Language. It is used for accessing and manipulating data in a database. It handles user requests. • Here are some tasks that come under DML: – Select: It is used to retrieve data from a database. – Insert: It is used to insert data into a table. – Update: It is used to update existing data within a table. – Delete: It is used to delete all records from a table. – Merge: It performs UPSERT operation, i.e., insert or update operations. – Call: It is used to call a structured query language or a Java subprogram. – Explain Plan: It has the parameter of explaining data. – Lock Table: It controls concurrency.
  • 78. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 78 Data Control Language (DCL) • DCL stands for Data Control Language. It is used to retrieve the stored or saved data. • The DCL execution is transactional. It also has rollback parameters. (But in Oracle database, the execution of data control language does not have the feature of rolling back.) • Here are some tasks that come under DCL: – Grant: It is used to give user access privileges to a database. – Revoke: It is used to take back permissions from the user. There are the following operations which have the authorization of Revoke: • CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT.
  • 79. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 79 Transaction Control Language (TCL) • TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical transaction. • Here are some tasks that come under TCL: – Commit: It is used to save the transaction on the database. – Rollback: It is used to restore the database to original since the last Commit.
  • 80. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 80 4/23/2024 80 Delete, Drop and Truncate DELETE Command DROP Command TRUNCATE Command Language The DELETE command is Data Manipulation Language Command. The DROP command is Data Definition Language Command. The TRUNCATE command is a Data Definition Language Command. Use The DELETE command deletes one or more existing records from the table in the database. The DROP Command drops the complete table from the database. The TRUNCATE Command deletes all the rows from the existing table, leaving the row with the column names. Transition We can restore any deleted row or multiple rows from the database using the ROLLBACK command. We cannot get the complete table deleted from the database using the ROLLBACK command. We cannot restore all the deleted rows from the database using the ROLLBACK command. Memory Space The DELETE command does not free the allocated space of the table from memory. The DROP command removes the space allocated for the table from memory. The TRUNCATE command does not free the space allocated for the table from memory. Performance Speed The DELETE command performs slower than the DROP command and TRUNCATE command as it deletes one or more rows based on a specific condition. The DROP Command has faster performance than DELETE Command but not as compared to the Truncate Command because the DROP command deletes the table from the database after deleting the rows. The TRUNCATE command works faster than the DROP command and DELETE command because it deletes all the records from the table without any condition. Permission DELETE permission is required to delete the rows of the table. We need ALTER permission on the schema to which the table belongs and CONTROL permission on the table to use the DROP command. We need table ALTER permission to use the TRUNCATE command. Syntax DELETE FROM table_name WHERE condition; DROP TABLE table_name; TRUNCATE TABLE table_name;
  • 81. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 81 4/23/2024 81 Short Quiz 1. The ability to query data, as well as insert, delete, and alter tuples, is offered by ____________ a) TCL (Transaction Control Language) b) DCL (Data Control Language) c) DDL (Data Definition Langauge) d) DML (Data Manipulation Langauge) 2. Which command is used to remove a relation from an SQL? a) Drop table b) Delete c) Purge d) Remove
  • 82. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 82 Short Quiz 1.Explain the terms database and DBMS. Also, mention the different types of DBMS. 2.What are the advantages of DBMS? 3.Mention the different languages present in DBMS 4.What are the different levels of abstraction in the DBMS? 5.Write Difference between schema and instances.
  • 83. Lecture 4 • ER Model • Entity and attributes • Relationship and degree of relationship • Mapping Cardinality • Participation Constraint • Keys in DBMS 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 83
  • 84. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 84 Topic- ER Model Objective 1. An entity relationship diagram gives a snapshot of how these entities relate to each other. You could call it the blueprint that underpins your business architecture, offering a visual representation of the relationships between different sets of data (entities). 2. An Entity Relationship (ER) Diagram is a type of flowchart that illustrates how “entities” such as people, objects or concepts relate to each other within a system. 3. It is a diagrammatic approach to database design, where you represent real-world objects as entities and mention relationships between them.
  • 85. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 85 Introduction of ER Model • A database can be modeled as: – a collection of entities, – relationship among entities. • An entity is an object that exists and is distinguishable from other objects. – Example: specific person, company, event, plant • Entities have attributes – Example: people have names and addresses • An entity set is a set of entities of the same type that share the same properties. – Example: set of all persons, companies, trees, holidays
  • 86. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 86 Introduction of ER Model • Entity: An entity is a real-world object having attributes, which are nothing but characteristics of that particular object. employee can be an entity. This particular entity can have empname, etc. • Entity Type: Entity type is nothing but a collection of entities, having the same attributes. Generally, an entity type refers to tables in a particular database. So, you can understand, entity characteristic which uniquely identifies the entity. For have attributes such as empid, empname, department, etc. • Entity Set: An entity set is the collection of all the entities of a particular entity type in a database. For example, a set of companies, and a set of people can come under an entity set. •
  • 87. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 87 Entity Sets customer and loan
  • 88. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 88 Attributes • An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set. • In ER diagram, attribute is represented by an oval. • Domain – the set of permitted values for each attribute Example: customer = (customer_id, customer_name, customer_street, customer_city ) loan = (loan_number, amount )
  • 89. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 89 Attribute Type • 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. • 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.
  • 90. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 90 Attribute Type • 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.
  • 91. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 91 Attribute Type • The complete entity type Student with its attributes can be represented as:
  • 92. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 92 Degree of Relationship Set • In DBMS, a degree of relationship represents the number of entity types that associate in a relationship. • The number of different entity sets participating in a relationship set is called as degree of a relationship set. – Unary Relationship – Binary Relationship – n-ary Relationship
  • 93. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 93 Unary Relationship • When there is only ONE entity set participating in a relation, the relationship is called as unary relationship. • For example, monitor is being selected from the students of the class
  • 94. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 94 Binary Relationship • When there are TWO entities set participating in a relation, the relationship is called as binary relationship. • For example, Student is enrolled in Course.
  • 95. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 95 n-ary Relationship • When there are n entities set participating in a relation, the relationship is called as n-ary relationship.
  • 96. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 96 Mapping Cardinalities/Degree • Mapping cardinalities or cardinality ratio express the number of entities to which another entity can be associated via a relationship set.
  • 97. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 97 Mapping Cardinalities Types of cardinality in between tables are: •one-to-one •one-to-many •many-to-one •many-to-many 1. One-to-one: In this type of cardinality mapping, an entity in A is connected to at most one entity in B. Or we can say that a unit or item in B is connected to at most one unit or item in A.
  • 98. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 98 Mapping Cardinalities Example: In a particular hospital, the surgeon department has one head of department. They both serve one-to-one relationships. 2. One-to-many: In this type of cardinality mapping, an entity in A is associated with any number of entities in B. Or we can say that one unit or item in B can be connected to at most one unit or item in A.
  • 99. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 99 Mapping Cardinalities Example: A doctor can prescribe more than one medicine 3. Many-to-one: In this type of cardinality mapping, an entity in A is connected to at most one entity in B. Or we can say a unit or item in B can be associated with any number (zero or more) of entities or items in A.
  • 100. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 100 Mapping Cardinalities Example: In a particular hospital, multiple surgeries are done by a single surgeon. Such a type of relationship is known as a many-to-one relationship.
  • 101. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 101 Mapping Cardinalities 4. Many-to-many: In this type of cardinality mapping, an entity in A is associated with any number of entities in B, and an entity in B is associated with any number of entities in A. Example: In a particular company, multiple people work on multiple projects. They serve many-to-many relationships.
  • 102. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 102 Participation Constraint • Total Participation – Each entity in the entity set must participate in the relationship. If each student must enroll in a course, the participation of student will be total. Total participation is shown by double line in ER diagram. • Partial Participation – The entity in the entity set may or may NOT participate in the relationship. If some courses are not enrolled by any of the student, the participation of course will be partial.
  • 103. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 103 Participation Constraint (contd..) • Using set, it can be represented as • Every student in Student Entity set is participating in relationship but there exists a course C4 which is not taking part in the relationship.
  • 104. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 104 Weak Entity Type & Identifying Relationship • An entity type has a key attribute which uniquely identifies each entity in the entity set. • But there exists some entity type for which key attribute can’t be defined. These are called Weak Entity type. • For example, A company may store the information of dependents (Parents, Children, Spouse) of an Employee. • But the dependents don’t have existence without the employee. • So Dependent will be weak entity type and Employee will be Identifying Entity type for Dependent.
  • 105. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 105 Weak Entity Type & Identifying Relationship • A weak entity type is represented by a double rectangle. The participation of weak entity type is always total. The relationship between weak entity type and its identifying strong entity type is called identifying relationship and it is represented by double diamond.
  • 106. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 106
  • 107. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 107 Keys in DBMS • KEYS in DBMS is an attribute or set of attributes which helps you to identify a row(tuple) in a relation(table). • They allow you to find the relation between two tables. • Keys help you uniquely identify a row in a table by a combination of one or more columns in that table. Example:- • In the above-given example, employee ID is a primary key because it uniquely identifies an employee record. In this table, no other employee can have the same employee ID. Employee ID FirstName LastName 11 Andrew Johnson 22 Tom Wood 33 Alex Hale
  • 108. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 108 Why we need a Key? Here are some reasons for using SQL key in the DBMS system. • Keys help you to identify any row of data in a table. • In a real-world application, a table could contain thousands of records. Moreover, the records could be duplicated. • Keys in RDBMS ensure that you can uniquely identify a table record despite these challenges. • Allows you to establish a relationship between and identify the relation between tables • Help you to enforce identity and integrity in the relationship.
  • 109. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 109 Types of Keys in DBMS There are mainly seven different types of Keys in DBMS and each key has it’s different functionality: – Super Key – A super key is a group of single or multiple keys which identifies rows in a table. – Primary Key – is a column or group of columns in a table that uniquely identify every row in that table. – Candidate Key – is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super key with no repeated attributes. – Alternate Key – is a column or group of columns in a table that uniquely identify every row in that table.
  • 110. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 110 Types of Keys in DBMS (contd..) – Foreign Key – is a column that creates a relationship between two tables. The purpose of Foreign keys is to maintain data integrity and allow navigation between two different instances of an entity. – Compound Key – has two or more attributes that allow you to uniquely recognize a specific record. It is possible that each column may not be unique by itself within the database. – Composite Key – is a combination of two or more columns that uniquely identify rows in a table. The combination of columns guarantees uniqueness, though individual uniqueness is not guaranteed.
  • 111. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 111 Super key • A superkey is a group of single or multiple keys which identifies rows in a table. A Super key may have additional attributes that are not needed for unique identification. Example: • In the above-given example, EmpSSN and EmpNum name are superkeys. EmpSSN EmpNum Empname 9812345098 AB05 Shown 9876512345 AB06 Roslyn 199937890 AB07 James
  • 112. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 112 Primary Key • PRIMARY KEY in DBMS is a column or group of columns in a table that uniquely identify every row in that table. The Primary Key can’t be a duplicate meaning the same value can’t appear more than once in the table. A table cannot have more than one primary key. Example: • In the following example, StudID is a Primary Key. StudID Roll No First Name LastName Email 1 11 Tom Price abc@gmail.com 2 12 Nick Wright xyz@gmail.com 3 13 Dana Natan mno@yahoo.com
  • 113. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 113 Primary Key (contd..) Rules for defining Primary key: • Two rows can’t have the same primary key value • The primary key field cannot be null. • The value in a primary key column can never be modified or updated if any foreign key refers to that primary key.
  • 114. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 114 Alternate key • ALTERNATE KEYS is a column or group of columns in a table that uniquely identify every row in that table. A table can have multiple choices for a primary key but only one can be set as the primary key. All the keys which are not primary key are called an Alternate Key. Example: • In this table, StudID, Roll No, Email are qualified to become a primary key. But since StudID is the primary key, Roll No, Email becomes the alternative key. StudID Roll No First Name LastName Email 1 11 Tom Price abc@gmail.com 2 12 Nick Wright xyz@gmail.com 3 13 Dana Natan mno@yahoo.com
  • 115. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 115 Candidate Key • CANDIDATE KEY in SQL is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super key with no repeated attributes. The Primary key should be selected from the candidate keys. Every table must have at least a single candidate key. A table can have multiple candidate keys but only a single primary key. Example: • Candidate key Example: In the given table Stud ID, Roll No, and email are candidate keys which help us to uniquely identify the student record in the table. StudID Roll No First Name LastName Email 1 11 Tom Price abc@gmail.com 2 12 Nick Wright xyz@gmail.com 3 13 Dana Natan mno@yahoo.com
  • 116. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 116 Candidate Key (contd..) Properties of Candidate key: • It must contain unique values • Candidate key in SQL may have multiple attributes • Can contain null values • It should contain minimum fields to ensure uniqueness • Uniquely identify each record in a table
  • 117. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 117 Foreign key • FOREIGN KEY is an attribute that creates a relationship between two tables. The purpose of Foreign keys is to maintain data integrity and allow navigation between two different instances of an entity. It acts as a cross-reference between two tables as it references the primary key of another table. Example: Persons Table orders Person ID LastNa me FirstNa me Age 1 Hansen Ola 30 2 Svends on Tove 23 3 Petters en Kari 20 OrderI D OrderNum ber PersonID 1 77895 3 2 44678 3 3 22456 2 4 24562 1
  • 118. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 118 Foreign key (contd..) • "PersonID" column in the "Orders" table points to the "PersonID" column in the "Persons" table. • The "PersonID" column in the "Persons" table is the PRIMARY KEY in the "Persons" table. • The "PersonID" column in the "Orders" table is a FOREIGN KEY in the "Orders" table. • The FOREIGN KEY constraint prevents invalid data from being inserted into the foreign key column, because it has to be one of the values contained in the parent table. • Syntax: CREATE TABLE Orders ( OrderID int NOT NULL, OrderNumber int NOT NULL, PersonID int, PRIMARY KEY (OrderID), FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)); • This concept is also known as Referential Integrity.
  • 119. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 119 Compound key • COMPOUND KEY has two or more attributes that allow you to uniquely recognize a specific record. It is possible that each column may not be unique by itself within the database. However, when combined with the other column or columns the combination of composite keys become unique. Example: • In this example, OrderNo and ProductID can’t be a primary key as it does not uniquely identify a record. However, a compound key of Order ID and Product ID could be used as it uniquely identified each record. OrderNo PorductID Product Name Quantity B005 JAP102459 Mouse 5 B005 DKT321573 USB 10 B005 OMG446789 LCD Monitor 20 B004 DKT321573 USB 15 B002 OMG446789 Laser Printer 3
  • 120. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 120 Composite key • COMPOSITE KEY is a combination of two or more columns that uniquely identify rows in a table. The combination of columns guarantees uniqueness, though individually uniqueness is not guaranteed. Hence, they are combined to uniquely identify records in a table. • The difference between compound and the composite key is that any part of the compound key can be a foreign key, but the composite key may or maybe not a part of the foreign key.
  • 121. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 121 Difference b/w Primary key & Foreign key Primary Key Foreign Key Helps you to uniquely identify a record in the table. It is a field in the table that is the primary key of another table. Primary Key never accept null values. A foreign key may accept multiple null values. Primary key is a clustered index and data in the DBMS table are physically organized in the sequence of the clustered index. A foreign key cannot automatically create an index, clustered or non-clustered. However, you can manually create an index on the foreign key. You can have the single Primary key in a table. You can have multiple foreign keys in a table.
  • 122. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 122 Short Quiz Q. Given the basic ER and relational models, which of the following is INCORRECT? answer choices 1. An attribute of an entity can have more than one value. 2. An attribute of an entity can be composite. 3. In a row of a relational table, an attribute can have more than one value. 4. In a row of a relational table, an attribute can have exactly one value or a NULL value. Q. Which type of entity cannot exist in the database unless another type of entity also exists in the database, but does not require that the identifier of that other entity be included as part of its own identifier? 1. Weak entity 2. Strong entity 3. ID-dependent entity 4. ID- independent entity
  • 123. Lecture 6 • Generalization, Specialization and Aggregation • Reduction of an ER diagram to tables • Examples of ER Diagram 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 123
  • 124. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit- 1 124 Topic- Generalization, Specialization and Aggregation Objective 1. Generalization of Entities helps in establishing relationships between the tables, as they have common attributes to be identified. It makes the structuring of the database management simpler and easy to identify all the relevant attributes. 2. Specialization helps in defining the set of subclasses of the entity type. Also, it helps in establishing extra specific attributes with all subclasses and added specific relationship types between each subclass and the other entity types or the other subclasses. 3. Inheritance is an important feature of Generalization and Specialization. It allows lower-level entities to inherit the attributes of higher-level entities. For example, the attributes of a Person class such as name, age, and gender can be inherited by lower-level entities such as Student or Teacher.
  • 125. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 125 Generalization • Generalization is the process of extracting common properties from a set of entities and create a generalized entity from it. • It is a bottom-up approach in which two or more entities can be generalized to a higher level entity if they have some attributes in common. • For Example, STUDENT and FACULTY can be generalized to a higher level entity called PERSON as shown in Figure. • In this case, common attributes like P_NAME, P_ADD become part of higher entity (PERSON) and specialized attributes like S_FEE become part of specialized entity (STUDENT).
  • 126. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 126 Example:
  • 127. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 127 Specialization • In specialization, an entity is divided into sub-entities based on their characteristics. • It is a top-down approach where higher level entity is specialized into two or more lower level entities. • For Example, EMPLOYEE entity in an Employee management system can be specialized into DEVELOPER, TESTER etc. as shown in Figure. • In this case, common attributes like E_NAME, E_SAL etc. become part of higher entity (EMPLOYEE) and specialized attributes like TES_TYPE become part of specialized entity (TESTER).
  • 128. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 128 Example:
  • 129. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 129 Aggregation • Aggregation refers to the process by which entities are combined to form a single meaningful entity. • The specific entities are combined because they do not make sense on their own. To establish a single entity, aggregation creates a relationship that combines these entities.
  • 130. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 130 Reduction of an ER diagrams to tables Objectives 1. Mapping an Entity Relationship (ER) model gives a good overview of the design of a system with the goal of making the system easier to understand at a technical level. 2. The ER diagrams can be mapped to a relation schema, which means we can clearly display the relationship between its members. 3. An Entity Relationship (ER) Diagram is a type of flowchart that illustrates how “entities” such as people, objects or concepts relate to each other within a system.
  • 131. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 131 Reduction of an ER diagrams to tables Rule-01: For Strong Entity Set With Only Simple Attributes • A strong entity set with only simple attributes will require only one table in relational model. – Attributes of the table will be the attributes of the entity set. – The primary key of the table will be the key attribute of the entity set. Schema : Student ( Roll_no , Name , Sex )
  • 132. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 132 RULE-02 Rule-02: For Strong Entity Set With Composite Attributes • A strong entity set with any number of composite attributes will require only one table in relational model. • While conversion, simple attributes of the composite attributes are taken into account and not the composite attribute itself. Schema : Student ( Roll_no , First_name , Last_name , House_no , Street , City )
  • 133. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 133 RULE-03 Rule-03: For Strong Entity Set With Multi Valued Attributes • A strong entity set with any number of multi valued attributes will require two tables in relational model. – One table will contain all the simple attributes with the primary key. – Other table will contain the primary key and all the multi valued attributes. • Roll_no City Roll_no Mobile_no
  • 134. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 134 RULE-04 Rule-04: Translating Relationship Set into a Table • A relationship set will require one table in the relational model. • Attributes of the table are- – Primary key attributes of the participating entity sets – Its own descriptive attributes if any. – Set of non-descriptive attributes will be the primary key. Schema : Works in ( Emp_no , Dept_id , experience ) exper ience
  • 135. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 135 RULE-05 Rule-05: For Binary Relationships With Cardinality Ratios • The following four cases are possible- – Case-01: Binary relationship with cardinality ratio m:n – Case-02: Binary relationship with cardinality ratio 1:n – Case-03: Binary relationship with cardinality ratio m:1 – Case-04: Binary relationship with cardinality ratio 1:1 •
  • 136. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 136 RULE-05 (contd..) Case-01: For Binary Relationship With Cardinality Ratio m:n • Here, three tables will be required- 1. A ( a1 , a2 ) 2. R ( a1 , b1 ) 3. B ( b1 , b2 )
  • 137. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 137 RULE-05 (contd..) Case-02: For Binary Relationship With Cardinality Ratio 1:n • Here, two tables will be required- 1. A ( a1 , a2 ) 2. BR ( a1 , b1 , b2 ) NOTE- Here, combined table will be drawn for the entity set B and relationship set R.
  • 138. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 138 RULE-05 (contd..) Case-03: For Binary Relationship With Cardinality Ratio m:1 • Here, two tables will be required- 1. AR ( a1 , a2 , b1 ) 2. B ( b1 , b2 ) NOTE- Here, combined table will be drawn for the entity set A and relationship set R.
  • 139. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 139 RULE-05 (contd..) Case-04: For Binary Relationship With Cardinality Ratio 1:1 • Here, two tables will be required. Either combine ‘R’ with ‘A’ or ‘B’ • Way-01: 1. AR ( a1 , a2 , b1 ) 2. B ( b1 , b2 ) • Way-02: 1. A ( a1 , a2 ) 2. BR ( a1 , b1 , b2 )
  • 140. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 140 RULE-06 Rule-06: For Binary Relationship With Both Cardinality Constraints and Participation Constraints- • Case-01: For Binary Relationship With Cardinality Constraint and Total Participation Constraint From One Side • Case-02: For Binary Relationship With Cardinality Constraint and Total Participation Constraint From Both Sides-
  • 141. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 141 RULE-06 (contd..) Case-01: For Binary Relationship With Cardinality Constraint and Total Participation Constraint From One Side • Because cardinality ratio = 1 : n , so we will combine the entity set B and relationship set R. • Then, two tables will be required- 1. A ( a1 , a2 ) 2. BR ( a1 , b1 , b2 ) • Because of total participation, foreign key a1 has acquired NOT NULL constraint, so it can’t be null now.
  • 142. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 142 RULE-06 (contd..) Case-02: For Binary Relationship With Cardinality Constraint and Total Participation Constraint From Both Sides • If there is a key constraint from both the sides of an entity set with total participation, then that binary relationship is represented using only single table. • Here, Only one table is required. 1. ARB ( a1 , a2 , b1 , b2 )
  • 143. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 143 RULE-07 Rule-07: For Binary Relationship With Weak Entity Set • Weak entity set always appears in association with identifying relationship with total participation constraint. • Here, two tables will be required- 1. A ( a1 , a2 ) 2. BR ( a1 , b1 , b2 )
  • 144. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 144 Examples of ER Diagram
  • 145. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 145 ER Diagram For Department
  • 146. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 146 ER Diagram for Company
  • 147. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 147 Summary of Conceptual Design • Conceptual design follows requirements analysis, – Yields a high-level description of data to be stored • ER model popular for conceptual design – Constructs are expressive, close to the way people think about their applications. • Basic constructs: entities, relationships, and attributes (of entities and relationships). • Some additional constructs: weak entities, ISA hierarchies, and aggregation. • Note: There are many variations on ER model.
  • 148. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 148 Summary of ER (Contd.) • ER design is subjective. There are often many ways to model a given scenario! Analyzing alternatives can be tricky, especially for a large enterprise. Common choices include: – Entity vs. attribute, entity vs. relationship, binary or n-ary relationship, whether or not to use ISA hierarchies, and whether or not to use aggregation. • Ensuring good database design: resulting relational schema should be analyzed and refined further. FD information and normalization techniques are especially useful.
  • 149. • Define Database System. • What do you understand by data independence? • Explain types of attributes in ER diagram. • What is generalization. • What do you understand by primary key? • Explain participation cardinality. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 149 Daily Quiz
  • 150. • Define: Data, Database, and Database System. • What is data independence? What are differences between Logical Data Independence and Physical Data Independence? • Give example of Simple, Composite, Single –valued and Multi- valued attributes of an entity. • What is the difference between Generalization & Specialization with respect to Database? • What is difference between total and partial participation? Explain by suitable example. • Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors. Associated with each patient, a log of the various tests and examinations conducted. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 150 Weekly Assignment
  • 151. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 151 Topic Links 1. https://www.geeksforgeeks.org/last-minute-notes-dbms/ 2. https://www.geeksforgeeks.org/quiz-corner-gq/#DBMS%20Mock%20Tests 3. https://www.geeksforgeeks.org/commonly-asked-dbms-interview- questions/ 4. https://www.geeksforgeeks.org/commonly-asked-dbms-interview- questions-set-2/
  • 152. • The entity relationship set is represented in E-R diagram as a) Double diamonds b) Undivided rectangles c) Dashed lines d) Diamond • The Rectangles divided into two parts represents a) Entity set b) Relationship set c) Attributes of a relationship set d) Primary key 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 152 MCQ s
  • 153. • An entity set that does not have sufficient attributes to form a primary key is termed a __________ a) Strong entity set b) Variant set c) Weak entity set d) Variable set • What term is used to refer to a specific record in your music database; for instance; information stored about a specific album? a) Relation b) Instance c) Table d) Column 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 153 MCQ s
  • 154. • Which of the following is generally used for performing tasks like creating the structure of the relations, deleting relation? DML(Data Manipulation Language) Query Relational Schema DDL(Data Definition Language) • Which of the following provides the ability to query information from the database and insert tuples into, delete tuples from, and modify tuples in the database? DML(Data Manipulation Language) DDL(Data Definition Language) Query Relational Schema 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 154 MCQ s
  • 155. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 155 Glossary Questions 1. Attempt all the parts. Pick the correct option from glossary. [CO1] (i) Double diamonds (ii) Database Management System (iii) Diamond (iv) Entity set (a). _____________is the full form of DBMS. (b). A weak relationship is represented in E-R diagram as___________. (c) The Rectangles in E-R diagram represents____________________. (d). The relationship is represented in E-R diagram as_____________. 2. Attempt all the parts. Pick the correct option from glossary. [CO1] (i ) FALSE (ii) TRUE (iii) Tuple (iv) Meta Data (a) A row of a relation is known as____________. (b)_____________________refers to the "data about data"? (c) Alternate Key is a kind of partial key in DBMS, which is created when you don’t have any natural primary key._______ (d) Generalization is a bottom-up approach.______
  • 156. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Sessional Paper-1 4/23/2024 156
  • 157. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 157
  • 158. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 158
  • 159. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Sessional Paper-2 4/23/2024 159
  • 160. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 160
  • 161. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 161
  • 162. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 162 Old University Question Paper
  • 163. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 163
  • 164. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 164
  • 165. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 165
  • 166. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 166 Old University Question Paper
  • 167. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 167
  • 168. Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 Conti…. 4/23/2024 168
  • 169. • http://www.aktuonline.com/papers/btech-cs-5-sem-data-base- management-system-KCS501-2020.pdf • http://www.aktuonline.com/papers/btech-cs-5-sem-database- management-system-KCS-501-2018-19.pdf • http://www.aktuonline.com/papers/btech-cs-5-sem-database- management-system-ncs-502-2017-18.pdf • http://www.aktuonline.com/papers/btech-cs-5-sem-database- management-system-ncs-502-2016-17.pdf 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 169 Old Question Papers
  • 170. • Explain types of attributes in ER diagram. • Explain the difference between a weak and a strong entity set with example. • Discuss three level of abstractions or schemas architecture of DBMS. • Define constraint and its types in DBMS. • Compare Generalization, Specialization and aggregation with suitable examples. • Draw overall structure of DBMS and explain its components in brief. • Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors. Associated with each patient, a log of the various tests and examinations conducted. • 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 170 Expected Questions for University Exam
  • 171. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 171 Recap of Unit • Knowledge of database architecture. • Knowledge of Entity Relationship model and its concepts. • Databse V/S File system.
  • 172. 4/23/2024 Shabnam Firdaus ACSAI-0402 -DBMS Unit-1 172