0% found this document useful (0 votes)
34 views44 pages

Adbms Unit-2 (Part-1)

Uploaded by

yashdas5392
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views44 pages

Adbms Unit-2 (Part-1)

Uploaded by

yashdas5392
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

ADVANCE DATABASE MANAGEMENT SYSTEM

UNIT -2

PROF. KOMAL BHARTI


PROF. NIHARIKA AGARWAL
What is Relational Structure?
The relational Structure uses a collection of tables to represent both data
and the relationships among those data. Each table has multiple columns,
and each column has a unique name. Tables are also known as relations.
The relational Structure is an example of a record-based model. Record-
based models are so named because the database is structured in fixed-
format records of several types. Each table contains records of a particular
type. Each record type defines a fixed number of fields, or attributes. The
columns of the table correspond to the attributes of the record type. The
relational data model is the most widely used data model, and a vast
majority of current database systems are based on the relational model.
What is Relational Structure?
What is the Relational ROLL_NO NAME ADDRESS PHONE AGE
Structure?
The relational Structure 1 RAM DELHI 9455123451 18

represents how data is stored


in Relational Databases. A 2 RAMESH GURGAON 9652431543 18

relational database consists of


a collection of tables, each of 3 SUJIT ROHTAK 9156253131 20

which is assigned a unique


4 SURESH DELHI 18
name. Consider a relation
STUDENT with attributes
ROLL_NO, NAME, ADDRESS,
PHONE, and AGE shown in
the table.
important terminology of Relational Structure
1.Tables,
2.Rows,
3.Columns,
4.Entity sets,
5.Attributes,
6.Types of entities
important terminology of Relational Structure
TABLE:SQL Table is a collection of data which is organized in terms of rows and
columns. In DBMS, the table is known as relation and row as a tuple.
Table is a simple form of data storage. A table is also considered as a convenient
representation of relations.

EXAMPLE OF TABLE CREATION


EMP_ID EMP_NAME CITY PHONE_NO
SQL> CREATE TABLE EMPLOYEE (
1 Kristen Washington 7289201223
EMP_ID INT NOT NULL,
2 Anna Franklin 9378282882 EMP_NAME VARCHAR (25) NOT NULL,
3 Jackson Bristol 9264783838 PHONE_NO INT NOT NULL,
4 Kellan California 7254728346 ADDRESS CHAR (30),
PRIMARY KEY (ID)
5 Ashley Hawaii 9638482678
);
important terminology of Relational Structure
Row: In the context of relational databases, a row represents a
single record in a table. Each row contains values for each column
defined in the table schema. In everyday database terminology, a
row is the term most commonly used to refer to a horizontal entry
in a table.
Working with Tuple in DBMS
In a relational database, a relation is defined by a set of attributes
and a set of tuples that have values for those attributes.
Example:
A relation called “CUSTOMER” might have attributes such as
“customer_id”, “first_name”, “last_name”, and “email”. Each tuple in
the relationship would have a unique value for the “customer_id”
attribute and corresponding values for the other attributes, such as
“John” for “first_name” and “Smith” for “last_name”.
customer first_na last_nam Tuples are also used in the process
_id me e email of normalization in a relational

abc@gm database. Normalization is the


1 John Smith ail.com process of organizing data in a
database to minimize data
cde@gm
2 Abhishek Bhosle ail.com redundancy and improve data
integrity. In the process of
fgh@gma normalization, a relation is broken
3 Natasha Witch il.com down into multiple smaller relations,
each with a specific purpose and
containing a specific set of attributes
and tuples.
3.Column: A column in a database table represents a specific
attribute or data field that each row in the table holds. Each
column has a distinct name and data type, which dictates the
kind of data that can be stored in that column.

Characteristics of Columns in Advanced DBMS

Data Type: Each column is defined with a data type that


determines the kind of data it can store, such as integers,
strings, dates, or floating-point numbers. Advanced DBMSs
support a wide range of data types, including complex types
like JSON or XML.
nts: Columns can have constraints that enforce certain rules on the
mmon constraints include:
Key: Uniquely identifies each record in the table.
Key: Ensures referential integrity between tables by linking to a
key in another table.
Ensures all values in the column are unique.

: Ensures that the column does not contain null values.


Provides a default value for the column if none is specified.

g: Columns can be indexed to improve query performance. Advanced


support various indexing methods, including B-trees, hash indexes,
re sophisticated types like bitmap indexes and full-text indexes.

Optimization: Modern DBMSs employ techniques such as columnar


(used in columnar databases) where data is stored by columns rather
ws. This can improve query performance for analytical queries that
subset of columns.
ntity:
n entity is referred to as an object or thing that exists in the real
orld. For example, customer, car, pen, etc.
ntities are stored in the database, and they should be
istinguishable, i.e., they should be easily identifiable from the
roup. For example, a group of pens that are from the same
ompany cannot be identified, so they are only objects, but pens
ith different colours become unique and will be called an entity
ke a red pen, green pen, blue pen, black pen, etc.
Database Management System
(DBMS) is an essential tool to
manage data, but do you know
how important entities are in
DBMS?
The role of the entity is the
a group of pens, we can easily identify any pen because of its
fferent colours, so a pen of different colours is an entity.

r extracting data from the database, each data must be unique


its own way so that it becomes easier to differentiate between
em. Distinct and unique data is known as an entity.

n entity has some attributes which depict the entity's


aracteristics. For example, an entity "Student" has attributes
ch as "Student_roll_no", "Student_name", "Student_subject",
d "Student_marks".
Attributes
In DBMS, we have entities, and each entity
contains some property about their behavior
which is also called the attribute. In relational
databases, we have tables, and each column
contains some entity that has some attributes,
so all the entries for that column should strictly
follow the attribute of the entity. Entities define
the characteristic property of the attributes.
ibutes are properties or characteristics of an entity.
ibutes are used to describe the entity. The attribute is
hing but a piece of data that gives more information about
entity. Attributes are used to distinguish one entity from
other entity. Attributes help to categorize the entity and
entity can be easily retrieved and manipulate the entity.
ibutes can help the database to be more structural and
archical. An entity with no attribute is of no use in the
abase.
mple
’s take the student as an entity. Students will have multiple
ibutes such as roll number, name, and class.
ese attributes are used to describe the student in more
Entity Type:
A collection of entities with general characteristics is
known as an entity type.
For example, a database of a corporate company has
entity types such as employees, departments, etc. In
DBMS, every entity type contains a set of attributes
that explain the entity.
The Employee entity type can have attributes such as
name, age, address, phone number, and salary.
The Department entity type can have attributes such
as name, number, and location in the department.
Strong Entity Type: It is an entity that has
1.

its own existence and is independent.


The entity relationship diagram represents a
strong entity type with the help of a single
rectangle. Below is the ERD of the strong
entity type:

n the above example, the "In the.


2. Weak Entity Type: It is an entity that
does not have its own existence and relies
on a strong entity for its existence.
The Entity Relationship Diagram represents
the weak entity type using double
rectangles. Below is the ERD of the weak
entity type:
In the above example, the "Customer" is Organization of a Database
In the above example, "Address" is a
the entity type with attributes such as ID, weak entity type with attributes
Name, Gender, and Phone Number. A database is organized
such intoas
tables, which are
House like spreadsheets
No., with
City, Location,
Customer is a strong entity type as it and
rows hascolumns.
a Each row represents a record, and each column
and State.
unique ID for each customer. represents a field or attribute.
The relationship between a strong
and a weak entity type is known as
1 Tablesan identifying relationship.
Store Using a double
data in rows diamond, the Entity-
and columns.
Relationship Diagram represents a
relationship between the strong and
2 Relationships
the weak entity type.
Connect tables based on common fields.

3 Indexes
Speed up data retrieval by creating shortcuts.
ER- MODEL IN DBMS?
•ER model stands for an Entity-Relationship model. It is a
high-level data model. This model is used to define the
data elements and relationship for a specified system.
•It develops a conceptual design for the database. It also
develops a very simple and easy to design view of data.
•In ER modeling, the database structure is portrayed as a
diagram called an entity-relationship diagram.
For example, Suppose we design a school database. In
this database, the student will be an entity with attributes
like address, name, id, age, etc. The address can be
another entity with attributes like city, street name, pin
code, etc and there will be a relationship between them.
Real-life Example: Online Store
Database
ER- MODEL IN DBMS? An online store might use a database to store product information, customer orders,
inventory levels, and payment details. This helps manage product listings, track orders,
Why Use ER Diagrams In DBMS? and ensure smooth operations.

ER diagrams represent the E-R model in a database, making them easy to


convert into relations (tables). Products
ER diagrams provide the purpose Name,of real-world
Description, modeling of objects which
Price, Inventory

makes them intently useful.


ER diagrams require no technical knowledge and no hardware support.
These diagrams are very easy to understand and easy to create even for a
Customers

naive user. Name, Address, Email, Order History

It gives a standard solution for visualizing the data logically.


Orders
Order ID, Date, Products, Total Amount
ER- MODEL IN DBMS?
Symbols Used in ER Model
ER Model is used to model the logical view of the system from a data
perspective which consists of these symbols:
Rectangles: Rectangles represent Entities in the ER Model.
Ellipses: Ellipses represent Attributes in the ER Model.
Diamond: Diamonds represent Relationships among Entities.
Lines: Lines represent attributes to entities and entity sets with other
relationship types.
Double Ellipse: Double Ellipses represent Multi-Valued Attributes.
Double Rectangle: Double Rectangle represents a Weak Entity.
ER- MODEL IN DBMS?
ER- MODEL IN DBMS?
Components of ER Diagram
ER Model consists of Entities, Attributes, and Relationships among Entities in a
Database System.
ER- MODEL IN DBMS?
What is Entity?
An Entity may be an object with a physical existence – a particular person,
car, house, or employee – or it may be an object with a conceptual
existence – a company, a job, or a university course.
What is Entity Set?
An Entity is an object of Entity Type and a set of all entities is called an
entity set. For Example, E1 is an entity having Entity Type Student and the
set of all students is called Entity Set. In ER diagram, Entity Type is
represented as:
ER- MODEL IN DBMS?
We can represent the entity
set in ER Diagram but can’t
represent entity in ER
Diagram because entity is
row and column in the
relation and ER Diagram is
graphical representation of
data.
ER- MODEL IN DBMS?
Types of Entity
There are two types of entity:
1. Strong Entity
A Strong Entity is a type of entity that has a key
Attribute. Strong Entity does not depend on other
Entity in the Schema. It has a primary key, that
helps in identifying it uniquely, and it is represented
by a rectangle. These are called Strong Entity
Types.
ER- MODEL IN DBMS?
2. Weak Entity
An Entity type has a key attribute that uniquely identifies each
entity in the entity set. But some entity type exists for which key
attributes can’t be defined. These are called Weak Entity types
For Example, A company may store the information of
dependents (Parents, Children, Spouse) of an Employee. But the
dependents can’t exist without the employee. So Dependent will
be a Weak Entity Type and Employee will be Identifying Entity
type for Dependent, which means it is Strong Entity Type.
A weak entity type is represented by a Double Rectangle. The
participation of weak entity types is always total. The relationship
between the weak entity type and its identifying strong entity type
is called identifying relationship and it is represented by a double
diamond.
What is Attributes?
Attributes are the properties
that define the entity type.
For example, Roll_No, Name,
DOB, Age, Address, and
Mobile_No are the attributes
that define entity type
Student. In ER diagram, the
attribute is represented by an
oval.
Types of Attributes
1. Key Attribute
The attribute
which uniquely
identifies each entity in
the entity set is called the
key attribute. For example,
Roll_No will be unique for
each student. In ER
diagram, the key attribute
is represented by an oval
with underlying lines.
2. Composite Attribute
An attribute composed of
many other attributes is
called a composite attribute.
For example, the Address
attribute of the student
Entity type consists of
Street, City, State, and
Country. In ER diagram, the
composite attribute is
represented by an oval
comprising of ovals.
3. Multivalued Attribute
An attribute consisting of more address

than one value for a given


entity. For example,
Phone_No,address (can be
more than one for a given
student). In ER diagram, a
multivalued attribute is
represented by a double oval.
4. Derived Attribute The Complete Entity Type Student
An attribute that can be with its Attributes can be
derived from other represented as:
attributes of the entity
type is known as a
derived attribute. e.g.;
Age (can be derived from
DOB). In ER diagram, the
derived attribute is
represented by a dashed
oval.
Relationship Type and Relationship Set
A Relationship Type represents the association between
entity types. For example, ‘Enrolled in’ is a relationship type
that exists between entity type Student and Course. In ER
diagram, the relationship type is represented by a diamond
and connecting the entities with lines.
Degree of a Relationship Set
The number of different entity sets participating in a
relationship set is called the degree of a relationship set.

1. Unary Relationship: When there is only ONE entity set


participating in a relation, the relationship is called a unary
relationship. For example, one person is married to only one
person.
2. Binary Relationship: When there are TWO entities
set participating in a relationship, the relationship is called
a binary relationship. For example, a Student is enrolled in
a Course.
3. Ternary Relationship: When there are three entity sets
participating in a relationship, the relationship is called a
ternary relationship.

4. N-ary Relationship: When there are n entities set


participating in a relationship, the relationship is called an n-
ary relationship.
What is Cardinality?
The number of times an entity of an entity set participates
in a relationship set is known as cardinality Cardinality can
be of different types:
1. One-to-One: When each entity in each entity set can
take part only once in the relationship, the cardinality is
one-to-one. Let us assume that a male can marry one
female and a female can marry one male. So the
relationship will be one-to-one.
the total number of tables that can be used in this is 2.
2. One-to-Many: In one-to-
many mapping as well where
each entity can be related to
more than one entity and the
total number of tables that
can be used in this is 2. Let us
assume that one surgeon
department can accommodate
many doctors. So the
Cardinality will be 1 to M. It
means one department has
many Doctors.
3. Many-to-One: When entities in one entity set
can take part only once in the relationship set and
entities in other entity sets can take part more
than once in the relationship set, cardinality is
many to one. Let us assume that a student can
take only one course but one course can be taken
by many students. So the cardinality will be n to 1.
It means that for one course there can be n
students but for one student, there will be only
one course.
The total number of tables that can be used in this
4. Many-to-Many: When
entities in all entity sets can
take part more than once in
the relationship cardinality is
many to many. Let us assume
that a student can take more
than one course and one
course can be taken by many
students. So the relationship
will be many to many.
the total number of tables that
can be used in this is 3.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy