SlideShare a Scribd company logo
GROUP BY,HAVING and ORDER
BY clause
DEEPAM AGGARWAL
1
org payroll
X 1500
Y 3500
Z 3000
GROUP BY Clause
SELECT Statement – Grouping Rows
Find the payrollof each organization.
SELECT org, sum(salary) payroll
FROM salary_statistics GROUP BY org
Result:
salary_statistics
emp org salary
A X 500
B X 1000
C Y 1000
D Y 2500
E Z 3000
2
org payroll
X 1500
Z 3000
HAVING Clause
Find the organizations with payroll less than $3200.
SELECT org, sum(salary) payroll
FROM salary_statistics
GROUP BY org HAVING payroll < 3200
Result:
salary_statistics
emp org salary
A X 500
B X 1000
C Y 1000
D Y 2500
E Z 3000
3
The Difference Between WHERE and HAVING Clauses
 WHERE gets processed before any GROUP BY, and so it doesn't have access
to aggregated values (that is, the results of min(), max(), etc. functions).
 HAVING gets processed after GROUP BY and so can be used to constrain the
result set to only those with aggregated values that match a certain
predicate.
Find the organizations with payroll less than $3200.
SELECT org, sum(salary) payroll
FROM salary_statistics }✗Incorrect
WHERE payroll < 3200
GROUP BY org
SELECT org, sum(salary) payroll
FROM salary_statistics }✓ Correct
GROUP BY org
HAVING payroll < 3200
4
SELECT Statement – ORDER BY Clause
Find students ordered by merit position.
SELECT *
FROM result
ORDER BY marks DESC
result
student marks
A 25
B 56
C 82
D 25
E 39
5

More Related Content

What's hot

SQL Queries
SQL QueriesSQL Queries
SQL Queries
Nilt1234
 
joins in database
 joins in database joins in database
joins in database
Sultan Arshad
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
pnp @in
 
oracle Sql constraint
oracle  Sql constraint oracle  Sql constraint
oracle Sql constraint
home
 
Group By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQLGroup By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQL
MSB Academy
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
NITISH KUMAR
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functions
sinhacp
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
Deepthi Rachumallu
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
Vignesh Saravanan
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
11. transaction sql
11. transaction sql11. transaction sql
11. transaction sql
Umang Gupta
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
Vigneshwaran Sankaran
 
Aggregate Function - Database
Aggregate Function - DatabaseAggregate Function - Database
Aggregate Function - Database
Shahadat153031
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
Jas Singh Bhasin
 
Subqueries
SubqueriesSubqueries
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
Dhananjay Goel
 
SQL
SQLSQL
Set operators
Set  operatorsSet  operators

What's hot (20)

SQL Queries
SQL QueriesSQL Queries
SQL Queries
 
joins in database
 joins in database joins in database
joins in database
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
 
oracle Sql constraint
oracle  Sql constraint oracle  Sql constraint
oracle Sql constraint
 
Group By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQLGroup By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQL
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
Sql commands
Sql commandsSql commands
Sql commands
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functions
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
11. transaction sql
11. transaction sql11. transaction sql
11. transaction sql
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
Aggregate Function - Database
Aggregate Function - DatabaseAggregate Function - Database
Aggregate Function - Database
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
 
Subqueries
SubqueriesSubqueries
Subqueries
 
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
 
SQL
SQLSQL
SQL
 
Set operators
Set  operatorsSet  operators
Set operators
 

Similar to Group By, Having Clause and Order By clause

Group by clause mod
Group by clause modGroup by clause mod
Group by clause mod
Nitesh Singh
 
12. Basic SQL Queries (2).pptx
12. Basic SQL Queries  (2).pptx12. Basic SQL Queries  (2).pptx
12. Basic SQL Queries (2).pptx
SabrinaShanta2
 
Les05
Les05Les05
SQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhh
SQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhhSQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhh
SQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhh
NaveeN547338
 
08_SQL OLAP DBMS DB2 GROUP BY CUBE ROLL UP .pptx
08_SQL OLAP DBMS DB2 GROUP BY CUBE ROLL UP .pptx08_SQL OLAP DBMS DB2 GROUP BY CUBE ROLL UP .pptx
08_SQL OLAP DBMS DB2 GROUP BY CUBE ROLL UP .pptx
ssuser52d6bf
 
Les04
Les04Les04
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
MrHello6
 
Les04
Les04Les04
Les04
Les04Les04
Dynamic websites lec2
Dynamic websites lec2Dynamic websites lec2
Dynamic websites lec2
Belal Arfa
 
Aggregate Functions,Final
Aggregate Functions,FinalAggregate Functions,Final
Aggregate Functions,Final
mukesh24pandey
 
Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)
Achmad Solichin
 
PHP mysql Aggregate functions
PHP mysql Aggregate functionsPHP mysql Aggregate functions
PHP mysql Aggregate functions
Mudasir Syed
 
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek SharmaIntroduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
अभिषेक शर्मा
 
Les06
Les06Les06
Les06
Les06Les06
James Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science PortfolioJames Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science Portfolio
colbydaman
 
Sql5
Sql5Sql5
Database Management System - SQL Advanced Training
Database Management System - SQL Advanced TrainingDatabase Management System - SQL Advanced Training
Database Management System - SQL Advanced Training
Moutasm Tamimi
 
Introduction to oracle functions
Introduction to oracle functionsIntroduction to oracle functions
Introduction to oracle functions
Nitesh Singh
 

Similar to Group By, Having Clause and Order By clause (20)

Group by clause mod
Group by clause modGroup by clause mod
Group by clause mod
 
12. Basic SQL Queries (2).pptx
12. Basic SQL Queries  (2).pptx12. Basic SQL Queries  (2).pptx
12. Basic SQL Queries (2).pptx
 
Les05
Les05Les05
Les05
 
SQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhh
SQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhhSQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhh
SQL-AGG-FUN.pdfiiiijuyyttfffgyyuyyyyyhhh
 
08_SQL OLAP DBMS DB2 GROUP BY CUBE ROLL UP .pptx
08_SQL OLAP DBMS DB2 GROUP BY CUBE ROLL UP .pptx08_SQL OLAP DBMS DB2 GROUP BY CUBE ROLL UP .pptx
08_SQL OLAP DBMS DB2 GROUP BY CUBE ROLL UP .pptx
 
Les04
Les04Les04
Les04
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
Les04
Les04Les04
Les04
 
Les04
Les04Les04
Les04
 
Dynamic websites lec2
Dynamic websites lec2Dynamic websites lec2
Dynamic websites lec2
 
Aggregate Functions,Final
Aggregate Functions,FinalAggregate Functions,Final
Aggregate Functions,Final
 
Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)
 
PHP mysql Aggregate functions
PHP mysql Aggregate functionsPHP mysql Aggregate functions
PHP mysql Aggregate functions
 
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek SharmaIntroduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
 
Les06
Les06Les06
Les06
 
Les06
Les06Les06
Les06
 
James Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science PortfolioJames Colby Maddox Business Intellignece and Computer Science Portfolio
James Colby Maddox Business Intellignece and Computer Science Portfolio
 
Sql5
Sql5Sql5
Sql5
 
Database Management System - SQL Advanced Training
Database Management System - SQL Advanced TrainingDatabase Management System - SQL Advanced Training
Database Management System - SQL Advanced Training
 
Introduction to oracle functions
Introduction to oracle functionsIntroduction to oracle functions
Introduction to oracle functions
 

More from Deepam Aggarwal

Frames and its components
Frames and its components Frames and its components
Frames and its components
Deepam Aggarwal
 
Bank managment system
Bank managment systemBank managment system
Bank managment system
Deepam Aggarwal
 
Monolithic and Procedural Programming
Monolithic and Procedural ProgrammingMonolithic and Procedural Programming
Monolithic and Procedural Programming
Deepam Aggarwal
 
Inventory Management
Inventory Management Inventory Management
Inventory Management
Deepam Aggarwal
 
Dynamic memory allocation and linked lists
Dynamic memory allocation and linked listsDynamic memory allocation and linked lists
Dynamic memory allocation and linked lists
Deepam Aggarwal
 
Cyber Criminal and Cyber Security
Cyber Criminal and Cyber Security Cyber Criminal and Cyber Security
Cyber Criminal and Cyber Security
Deepam Aggarwal
 
Mdi vb.net
Mdi vb.netMdi vb.net
Mdi vb.net
Deepam Aggarwal
 
Stress Management
Stress Management Stress Management
Stress Management
Deepam Aggarwal
 
Impressionism
ImpressionismImpressionism
Impressionism
Deepam Aggarwal
 
Powersharinginindia 150527161221-lva1-app6892
Powersharinginindia 150527161221-lva1-app6892Powersharinginindia 150527161221-lva1-app6892
Powersharinginindia 150527161221-lva1-app6892
Deepam Aggarwal
 
Triangle and its properties
Triangle and its propertiesTriangle and its properties
Triangle and its properties
Deepam Aggarwal
 
probability-game of chances
probability-game of chancesprobability-game of chances
probability-game of chances
Deepam Aggarwal
 
Political and public awareness through media (B.st)
Political and public awareness through media (B.st)Political and public awareness through media (B.st)
Political and public awareness through media (B.st)
Deepam Aggarwal
 

More from Deepam Aggarwal (13)

Frames and its components
Frames and its components Frames and its components
Frames and its components
 
Bank managment system
Bank managment systemBank managment system
Bank managment system
 
Monolithic and Procedural Programming
Monolithic and Procedural ProgrammingMonolithic and Procedural Programming
Monolithic and Procedural Programming
 
Inventory Management
Inventory Management Inventory Management
Inventory Management
 
Dynamic memory allocation and linked lists
Dynamic memory allocation and linked listsDynamic memory allocation and linked lists
Dynamic memory allocation and linked lists
 
Cyber Criminal and Cyber Security
Cyber Criminal and Cyber Security Cyber Criminal and Cyber Security
Cyber Criminal and Cyber Security
 
Mdi vb.net
Mdi vb.netMdi vb.net
Mdi vb.net
 
Stress Management
Stress Management Stress Management
Stress Management
 
Impressionism
ImpressionismImpressionism
Impressionism
 
Powersharinginindia 150527161221-lva1-app6892
Powersharinginindia 150527161221-lva1-app6892Powersharinginindia 150527161221-lva1-app6892
Powersharinginindia 150527161221-lva1-app6892
 
Triangle and its properties
Triangle and its propertiesTriangle and its properties
Triangle and its properties
 
probability-game of chances
probability-game of chancesprobability-game of chances
probability-game of chances
 
Political and public awareness through media (B.st)
Political and public awareness through media (B.st)Political and public awareness through media (B.st)
Political and public awareness through media (B.st)
 

Recently uploaded

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 

Recently uploaded (20)

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 

Group By, Having Clause and Order By clause

  • 1. GROUP BY,HAVING and ORDER BY clause DEEPAM AGGARWAL 1
  • 2. org payroll X 1500 Y 3500 Z 3000 GROUP BY Clause SELECT Statement – Grouping Rows Find the payrollof each organization. SELECT org, sum(salary) payroll FROM salary_statistics GROUP BY org Result: salary_statistics emp org salary A X 500 B X 1000 C Y 1000 D Y 2500 E Z 3000 2
  • 3. org payroll X 1500 Z 3000 HAVING Clause Find the organizations with payroll less than $3200. SELECT org, sum(salary) payroll FROM salary_statistics GROUP BY org HAVING payroll < 3200 Result: salary_statistics emp org salary A X 500 B X 1000 C Y 1000 D Y 2500 E Z 3000 3
  • 4. The Difference Between WHERE and HAVING Clauses  WHERE gets processed before any GROUP BY, and so it doesn't have access to aggregated values (that is, the results of min(), max(), etc. functions).  HAVING gets processed after GROUP BY and so can be used to constrain the result set to only those with aggregated values that match a certain predicate. Find the organizations with payroll less than $3200. SELECT org, sum(salary) payroll FROM salary_statistics }✗Incorrect WHERE payroll < 3200 GROUP BY org SELECT org, sum(salary) payroll FROM salary_statistics }✓ Correct GROUP BY org HAVING payroll < 3200 4
  • 5. SELECT Statement – ORDER BY Clause Find students ordered by merit position. SELECT * FROM result ORDER BY marks DESC result student marks A 25 B 56 C 82 D 25 E 39 5