Professional Documents
Culture Documents
Dbms
Dbms
Dbms
MANAGNMET
SYSTEM
SUBMITTED BY:
NAME: AROOJ FATIMA
ROLL NO: 21:F1:136
SEMESTER : 2ND
SESSEION: ADP (IT)
SUBMITTED TO:
MAAM FAREEHA ARSHAD
Table of Contents
Aggregate Functions in DBMS:................................................................................................................3
TYPES OF AGREGATE FUNCTION....................................................................................................3
AVG Function........................................................................................................................................3
COUNT Function..................................................................................................................................3
SUM Function........................................................................................................................................3
MAX Function.......................................................................................................................................4
MIN Function........................................................................................................................................4
SQL aggregate functions syntax...............................................................................................................4
aggregate function examples.....................................................................................................................4
COUNT function example....................................................................................................................4
AVG function example..........................................................................................................................5
SUM function example..........................................................................................................................5
MIN function example...........................................................................................................................6
MAX function example.........................................................................................................................6
Uses of aggregation in DBMS...................................................................................................................7
Many trivial entities:.............................................................................................................................7
One trivial entity:..................................................................................................................................7
Inapplicable entity-model relationship:...............................................................................................7
Process flow for aggregation in DBMS....................................................................................................7
The following are the main types of relationships in an ER model:..................................................8
One-to-one:.........................................................................................................................................8
One-to-many:.....................................................................................................................................8
Many-to-one:......................................................................................................................................8
Many-to-many:..................................................................................................................................8
Example of aggregation in DBMS............................................................................................................8
What are the data aggregation techniques in DBMS?............................................................................9
In-Network Aggregation.......................................................................................................................9
Tree-Based Approach............................................................................................................................9
Multi-Path Approach............................................................................................................................9
Cluster-Based Approach.......................................................................................................................9
Why is Aggregation important in DBMS?...............................................................................................9
Example to Implement in DBMS.............................................................................................................9
Significance of Aggregation in DBMS....................................................................................................10
Conclusion................................................................................................................................................11
Aggregate Functions in DBMS:
Aggregate functions are those functions in the DBMS which takes the values of multiple rows of
a single column and then form a single value by using a query. These functions allow the user to
summarizing the data. These functions ignore the NULL values except the count function.
AVG Function
This function takes the values from the given
column and then returns the average of the
values. This function works only on the
datatypes, which are specified as numeric in the
table.
Let's take an example, which describes to you how to use the AVG function in SQL. Suppose we
want to calculate the average salary from the Employee Details table, then we have to type the
following query:
Select AVG (Employee salary) from Employee Details;
COUNT Function
This aggregate function returns the total number of values in the specified column. This function
can work on any type of data, i.e., numeric as well as non-numeric. This function does not count
the NULL values. If we want to count all the rows with NULL values, then we have to use the
Count (*) function.
Let's take an example, which describes to us how to use the COUNT function in SQL. Suppose a
user wants to count the number of employees in the Employee Details table, then we have to
type the following query:
Select Count (Employee ID) from Employee Details;
SUM Function
This aggregate function sums all the non-NULL values of the given column. Like the AVG
function, this function also works only on the numeric data.
Let's take an example, which describes to you how to use the SUM function in SQL. Suppose a
user wants to find the sum of salary from the Employee Details table, then we have to type the
following query:
Select SUM (Employee salary) from Employee Details;
MAX Function
This function returns the value, which is maximum from the specified column.
Let's take an example, which describes to you how to use the MAX function in SQL. Suppose
we want to find the maximum price of the Cars Price column from the Cars table, then we have
to type the following query:
Select MAX (Cars Price) from Cars;
MIN Function
This function returns the value, which is minimum from the specified column.
Let's take an example, which describes to you how to use the MIN function in SQL. Suppose we
want to find the minimum price of the Bikes Price column from the Bikes table, then we have to
type the following query:
Select MIN (Bikes Price) from Bikes;
To calculate units in stock by product category, you use the AVG function with the GROUP
BY clause as follows:
SELECT
Category id, AVG (units in stock)
FROM
products
GROUP BY category id;
Check it out the SUM function tutorial for more information on how to use the SUM function.
One-to-many:
In this relationship, one entity forms a relationship
with multiple entities. For example, an employee can work in multiple departments within the
same organization.
Many-to-one:
Here, multiple entities in a certain entity set can form a relationship with only one entity. For
example, many employees can work in only one department.
Many-to-many:
In this category, multiple entities from a certain entity set, that can form a relationship with
many entities from another entity set. For example, many employees can work in multiple
departments within the same organization.
In this ER model, A, B, and C represent entities. A and B should be combined into a single
complex entity. R1 is the relationship that is formed after A and B are linked. R1 needs to form a
relationship with other entities for other DBMS operations to be successful.
This operation generates a new relationship (R2). R2 is linked to another entity C to enhance its
functionality. This entity is also formed through aggregation.
In-Network Aggregation
It is a general procedure where the information is gathered and routed using a multi-hop network.
This impressive technique is the cornerstone of the database management system.
Tree-Based Approach
The Aggregation from developing an aggregation tree is defined with the help of a tree-based
approach. It is a very important technique for performing database management procedures
brilliantly.
Multi-Path Approach
The partially aggregated data is transferred to a particular parent mode during the multi-path
approach. All the nodes are sent to many different inputs in this type of Aggregation.
Cluster-Based Approach
This technique is utilized for collating a great sort of data on the complete network. The cluster-
based approach is equipped with a cluster head chosen from various cluster members.
Conclusion
Aggregation of Entities in the Database Management System corresponds to a connection
between two entities that are theoretically at the same hierarchical level in the ER model. The
relationship created between the entities can also be represented in the ER model as ‘has-a,’ ‘is-
a’ or ‘is-part-of’ relationships, which can have any type of entities from the Entity-Relationship
tree. Aggregation does not characterize any alteration on the flow of navigation through the
hierarchical ER model, or the relationship pattern in the ER model.