際際滷

際際滷Share a Scribd company logo
Database Management
System (LAB-05)
Md . Tanvir Khan Fahim
ID: 2014755005
Agenda
? Uses of Set Operation(Union , Intersect , Except).
? Uses of Aggregate Functions(Avg , Max , Min , Sum , Count).
? Uses of Some Other SQL Functions.
Uses of Set Operations
? The SQL operations union, intersect and except operate on relations
and corresponds to the algebra operations U, ” and -.
Union:
? It is used to combine the result set of two select queries.
? Eliminate duplicates.
Union All:
For duplicates, use union all clause.
Intersect:
The intersection operation between two selections returns only the common data sets or rows between them.
* Eliminate duplicates.
Intersect All:
For duplicates, use intersect all clause.
Except/Minus:
Except operations are needed to extract those tuples that are in one
SQL query but not in other query.
* Eliminate duplicates.
Uses of Set Operations
Set Operations can be demonstrated as follows:
Uses of Set Operations
Implementations of Set Operations:
Table: person Table:person1
select id from person union select id from person1;
Uses of Set Operations
select id from person union all select id from person1;
select id from person intersect select id from person1;
Uses of Set Operations
Except/Minus:
person1 person
select id from person1 minus select id from person;
Uses of Aggregate Functions
? SQL offers five built-in aggregate functions:
1. Average: avg()
2. Minimum: min()
3. Maximum: max()
4. Total: sum()
5. Count: count()
avg():The AVG() function calculates the average of a set of values.
Min(): The MIN() aggregate function returns the lowest value (minimum) in a set of non-NULL values.
Max(): The MAX() aggregate function returns the highest value (maximum) in a set of non-NULL values.
Sum(): The SUM() function returns the total sum of a numeric column.
Count(): The COUNT() function returns the number of rows in a database table.
Uses of Aggregate Functions
Implementation of Aggregate Functions:
Table: person
select avg(ID) as New_ID from person;
select min(ID) as New_ID from person;
Uses of Aggregate Functions
? select max(ID) as New_ID from person;
select sum(ID) as New_ID from person;
? select count(ID) as New_ID from person;
Uses of Some Other SQL Functions.
? There is so many functions in SQL such as:
Abs():The ABS() function returns the absolute value of a number.
select abs(-13) from dual;
Power():The POWER() function returns the value of a number raised to the power of another number.
select power(5,2) from dual;
Round(): The ROUND() function rounds a number to a specified number of decimal places.
select Round(3.75) from dual;
Uses of Some Other SQL Functions.
Sqrt(): The SQRT() function returns the square root of a number.
select sqrt(25) from dual;
Truncate(): The TRUNCATE() function truncates a number to the specified number of decimal places.
select truncate(3.1416,2) from dual;
Thank You

More Related Content

Similar to database_set_operations_&_function.pptx (20)

PDF
5.Agg. Function.pdf
ssuser8b6c85
?
PPTX
MS Sql Server: Doing Calculations With Functions
DataminingTools Inc
?
PPTX
MS SQLSERVER:Doing Calculations With Functions
sqlserver content
?
PPTX
MS SQL SERVER: Doing Calculations With Functions
sqlserver content
?
PPT
SQL Queries
Nilt1234
?
PPT
Aggregate functions
sinhacp
?
PDF
Sql wksht-3
Mukesh Tekwani
?
PDF
M|18 User Defined Functions
MariaDB plc
?
PPT
MYSQL Aggregate Functions
Leroy Blair
?
RTF
Sql functions
ilias ahmed
?
PDF
advance-sqaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal.pdf
traphuong2103
?
PPTX
12. Basic SQL Queries (2).pptx
SabrinaShanta2
?
PDF
6. Aggregate Functions.pdf
Sunita Milind Dol
?
PPTX
DBMS: Week 07 - Advanced SQL Queries in MySQL
RashidFaridChishti
?
PDF
SQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhh
NaveeN547338
?
PDF
0716330552518_DBMS_LAB_THEORY_SQL_OPERATOR (1).pdf
sahilurrahemankhan
?
PDF
MySQL-commands.pdf
ssuserc5aa74
?
PPTX
Aggregate functions
Rosie Jane Enomar
?
DOCX
Database Query Using SQL_ip.docx
VandanaGoyal21
?
PPTX
Sql FUNCTIONS
Abrar ali
?
5.Agg. Function.pdf
ssuser8b6c85
?
MS Sql Server: Doing Calculations With Functions
DataminingTools Inc
?
MS SQLSERVER:Doing Calculations With Functions
sqlserver content
?
MS SQL SERVER: Doing Calculations With Functions
sqlserver content
?
SQL Queries
Nilt1234
?
Aggregate functions
sinhacp
?
Sql wksht-3
Mukesh Tekwani
?
M|18 User Defined Functions
MariaDB plc
?
MYSQL Aggregate Functions
Leroy Blair
?
Sql functions
ilias ahmed
?
advance-sqaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal.pdf
traphuong2103
?
12. Basic SQL Queries (2).pptx
SabrinaShanta2
?
6. Aggregate Functions.pdf
Sunita Milind Dol
?
DBMS: Week 07 - Advanced SQL Queries in MySQL
RashidFaridChishti
?
SQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhh
NaveeN547338
?
0716330552518_DBMS_LAB_THEORY_SQL_OPERATOR (1).pdf
sahilurrahemankhan
?
MySQL-commands.pdf
ssuserc5aa74
?
Aggregate functions
Rosie Jane Enomar
?
Database Query Using SQL_ip.docx
VandanaGoyal21
?
Sql FUNCTIONS
Abrar ali
?

Recently uploaded (20)

PPTX
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
?
PDF
????? ?? ??????? ?????????? ????? ?????? ??? ????.pdf
???? ??? ?????
?
PPTX
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
?
PPTX
CST413 KTU S7 CSE Machine Learning Neural Networks and Support Vector Machine...
resming1
?
PPTX
How to Un-Obsolete Your Legacy Keypad Design
Epec Engineered Technologies
?
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
?
PPTX
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
?
PDF
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
?
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
?
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
?
PDF
i氏Y創_Miipher and Miipher2 .
鰻粥京晦粥皆幄塀氏芙
?
PDF
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
?
PPTX
Functions in Python Programming Language
BeulahS2
?
PPTX
Mobile database systems 20254545645.pptx
herosh1968
?
PDF
PRIZ Academy - Process functional modelling
PRIZ Guru
?
PPT
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
?
PPTX
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
?
PDF
Decision support system in machine learning models for a face recognition-bas...
TELKOMNIKA JOURNAL
?
PPTX
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
rr22001247
?
PPTX
Bitumen Emulsion by Dr Sangita Ex CRRI Delhi
grilcodes
?
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
?
????? ?? ??????? ?????????? ????? ?????? ??? ????.pdf
???? ??? ?????
?
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
?
CST413 KTU S7 CSE Machine Learning Neural Networks and Support Vector Machine...
resming1
?
How to Un-Obsolete Your Legacy Keypad Design
Epec Engineered Technologies
?
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
?
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
?
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
?
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
?
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
?
i氏Y創_Miipher and Miipher2 .
鰻粥京晦粥皆幄塀氏芙
?
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
?
Functions in Python Programming Language
BeulahS2
?
Mobile database systems 20254545645.pptx
herosh1968
?
PRIZ Academy - Process functional modelling
PRIZ Guru
?
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
?
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
?
Decision support system in machine learning models for a face recognition-bas...
TELKOMNIKA JOURNAL
?
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
rr22001247
?
Bitumen Emulsion by Dr Sangita Ex CRRI Delhi
grilcodes
?
Ad

database_set_operations_&_function.pptx

  • 1. Database Management System (LAB-05) Md . Tanvir Khan Fahim ID: 2014755005
  • 2. Agenda ? Uses of Set Operation(Union , Intersect , Except). ? Uses of Aggregate Functions(Avg , Max , Min , Sum , Count). ? Uses of Some Other SQL Functions.
  • 3. Uses of Set Operations ? The SQL operations union, intersect and except operate on relations and corresponds to the algebra operations U, ” and -. Union: ? It is used to combine the result set of two select queries. ? Eliminate duplicates. Union All: For duplicates, use union all clause. Intersect: The intersection operation between two selections returns only the common data sets or rows between them. * Eliminate duplicates. Intersect All: For duplicates, use intersect all clause. Except/Minus: Except operations are needed to extract those tuples that are in one SQL query but not in other query. * Eliminate duplicates.
  • 4. Uses of Set Operations Set Operations can be demonstrated as follows:
  • 5. Uses of Set Operations Implementations of Set Operations: Table: person Table:person1 select id from person union select id from person1;
  • 6. Uses of Set Operations select id from person union all select id from person1; select id from person intersect select id from person1;
  • 7. Uses of Set Operations Except/Minus: person1 person select id from person1 minus select id from person;
  • 8. Uses of Aggregate Functions ? SQL offers five built-in aggregate functions: 1. Average: avg() 2. Minimum: min() 3. Maximum: max() 4. Total: sum() 5. Count: count() avg():The AVG() function calculates the average of a set of values. Min(): The MIN() aggregate function returns the lowest value (minimum) in a set of non-NULL values. Max(): The MAX() aggregate function returns the highest value (maximum) in a set of non-NULL values. Sum(): The SUM() function returns the total sum of a numeric column. Count(): The COUNT() function returns the number of rows in a database table.
  • 9. Uses of Aggregate Functions Implementation of Aggregate Functions: Table: person select avg(ID) as New_ID from person; select min(ID) as New_ID from person;
  • 10. Uses of Aggregate Functions ? select max(ID) as New_ID from person; select sum(ID) as New_ID from person; ? select count(ID) as New_ID from person;
  • 11. Uses of Some Other SQL Functions. ? There is so many functions in SQL such as: Abs():The ABS() function returns the absolute value of a number. select abs(-13) from dual; Power():The POWER() function returns the value of a number raised to the power of another number. select power(5,2) from dual; Round(): The ROUND() function rounds a number to a specified number of decimal places. select Round(3.75) from dual;
  • 12. Uses of Some Other SQL Functions. Sqrt(): The SQRT() function returns the square root of a number. select sqrt(25) from dual; Truncate(): The TRUNCATE() function truncates a number to the specified number of decimal places. select truncate(3.1416,2) from dual;