Submit Search
Upload
Sub-queries,Groupby and having in SQL
•
2 likes
•
595 views
V
Vikash Sharma
Follow
Using Subqueries , Groupby and Having in MySql
Read less
Read more
Education
Slideshow view
Report
Share
Slideshow view
Report
Share
1 of 12
Recommended
SQL Functions - Oracle SQL Fundamentals
SQL Functions - Oracle SQL Fundamentals
MuhammadWaheed44
V15 like operator-c
V15 like operator-c
Dhirendra Chauhan
Vp lecture 3 ararat
Vp lecture 3 ararat
Saman M. Almufti
Basics of SELECT Statement - Oracle SQL
Basics of SELECT Statement - Oracle SQL
MuhammadWaheed44
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
MuhammadWaheed44
5. Group Functions
5. Group Functions
Evelyn Oluchukwu
Indexes
Indexes
Yaswanth Babu Gummadivelli
Swift 3.0 の新しい機能(のうちの9つ)
Swift 3.0 の新しい機能(のうちの9つ)
Tomohiro Kumagai
Recommended
SQL Functions - Oracle SQL Fundamentals
SQL Functions - Oracle SQL Fundamentals
MuhammadWaheed44
V15 like operator-c
V15 like operator-c
Dhirendra Chauhan
Vp lecture 3 ararat
Vp lecture 3 ararat
Saman M. Almufti
Basics of SELECT Statement - Oracle SQL
Basics of SELECT Statement - Oracle SQL
MuhammadWaheed44
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
MuhammadWaheed44
5. Group Functions
5. Group Functions
Evelyn Oluchukwu
Indexes
Indexes
Yaswanth Babu Gummadivelli
Swift 3.0 の新しい機能(のうちの9つ)
Swift 3.0 の新しい機能(のうちの9つ)
Tomohiro Kumagai
Procedures and triggers in SQL
Procedures and triggers in SQL
Vikash Sharma
What's new in Apache Hive
What's new in Apache Hive
DataWorks Summit
Using grouping sets in sql server 2008 tech republic
Using grouping sets in sql server 2008 tech republic
Kaing Menglieng
Sql db optimization
Sql db optimization
Nikhildas P C
MS SQL SERVER: Creating Views
MS SQL SERVER: Creating Views
sqlserver content
Joins SQL Server
Joins SQL Server
baabtra.com - No. 1 supplier of quality freshers
Consultas en MS SQL Server 2012
Consultas en MS SQL Server 2012
CarlosFloresRoman
Sql xp 04
Sql xp 04
Niit Care
Sql tuning guideline
Sql tuning guideline
Sidney Chen
Statistics
Statistics
Riteshkiit
e computer notes - Subqueries
e computer notes - Subqueries
ecomputernotes
Locking in SQL Server
Locking in SQL Server
Prashant Gogoi
Review of SQL
Review of SQL
Information Technology
Triggers-Sequences-SQL
Triggers-Sequences-SQL
Patrick Seery
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
Andriy Krayniy
Lecture 4. MS SQL. DML Triggers
Lecture 4. MS SQL. DML Triggers
Alexey Furmanov
Sql query analyzer & maintenance
Sql query analyzer & maintenance
nspyrenet
Locking And Concurrency
Locking And Concurrency
sqlserver.co.il
SQL Server - Using Tools to Analyze Query Performance
SQL Server - Using Tools to Analyze Query Performance
Marek Maśko
View, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - Thaipt
Framgia Vietnam
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
Celine George
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
More Related Content
Viewers also liked
Procedures and triggers in SQL
Procedures and triggers in SQL
Vikash Sharma
What's new in Apache Hive
What's new in Apache Hive
DataWorks Summit
Using grouping sets in sql server 2008 tech republic
Using grouping sets in sql server 2008 tech republic
Kaing Menglieng
Sql db optimization
Sql db optimization
Nikhildas P C
MS SQL SERVER: Creating Views
MS SQL SERVER: Creating Views
sqlserver content
Joins SQL Server
Joins SQL Server
baabtra.com - No. 1 supplier of quality freshers
Consultas en MS SQL Server 2012
Consultas en MS SQL Server 2012
CarlosFloresRoman
Sql xp 04
Sql xp 04
Niit Care
Sql tuning guideline
Sql tuning guideline
Sidney Chen
Statistics
Statistics
Riteshkiit
e computer notes - Subqueries
e computer notes - Subqueries
ecomputernotes
Locking in SQL Server
Locking in SQL Server
Prashant Gogoi
Review of SQL
Review of SQL
Information Technology
Triggers-Sequences-SQL
Triggers-Sequences-SQL
Patrick Seery
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
Andriy Krayniy
Lecture 4. MS SQL. DML Triggers
Lecture 4. MS SQL. DML Triggers
Alexey Furmanov
Sql query analyzer & maintenance
Sql query analyzer & maintenance
nspyrenet
Locking And Concurrency
Locking And Concurrency
sqlserver.co.il
SQL Server - Using Tools to Analyze Query Performance
SQL Server - Using Tools to Analyze Query Performance
Marek Maśko
View, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - Thaipt
Framgia Vietnam
Viewers also liked
(20)
Procedures and triggers in SQL
Procedures and triggers in SQL
What's new in Apache Hive
What's new in Apache Hive
Using grouping sets in sql server 2008 tech republic
Using grouping sets in sql server 2008 tech republic
Sql db optimization
Sql db optimization
MS SQL SERVER: Creating Views
MS SQL SERVER: Creating Views
Joins SQL Server
Joins SQL Server
Consultas en MS SQL Server 2012
Consultas en MS SQL Server 2012
Sql xp 04
Sql xp 04
Sql tuning guideline
Sql tuning guideline
Statistics
Statistics
e computer notes - Subqueries
e computer notes - Subqueries
Locking in SQL Server
Locking in SQL Server
Review of SQL
Review of SQL
Triggers-Sequences-SQL
Triggers-Sequences-SQL
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
Lecture 4. MS SQL. DML Triggers
Lecture 4. MS SQL. DML Triggers
Sql query analyzer & maintenance
Sql query analyzer & maintenance
Locking And Concurrency
Locking And Concurrency
SQL Server - Using Tools to Analyze Query Performance
SQL Server - Using Tools to Analyze Query Performance
View, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - Thaipt
Recently uploaded
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
Celine George
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
UmeshTimilsina1
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Denish Jangid
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
Jisc
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
christianmathematics
Application orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
RamjanShidvankar
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
Jisc
Single or Multiple melodic lines structure
Single or Multiple melodic lines structure
dhanjurrannsibayan2
Understanding Accommodations and Modifications
Understanding Accommodations and Modifications
MJDuyan
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
jbellavia9
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
Esquimalt MFRC
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
Ramakrishna Reddy Bijjam
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
Nirmal Dwivedi
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
Celine George
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
Nguyen Thanh Tu Collection
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Pooja Bhuva
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
Celine George
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
pradhanghanshyam7136
Recently uploaded
(20)
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
Application orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
Single or Multiple melodic lines structure
Single or Multiple melodic lines structure
Understanding Accommodations and Modifications
Understanding Accommodations and Modifications
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Sub-queries,Groupby and having in SQL
1.
Sub-queries In MySql
2.
Subqueries ● SELECT
statement embedded in a clause of another SELECT statement.
3.
Subqueries - Syntax
SELECT /* outer statement begins */ Table_1.column_1, Table_1.column_2 FROM Table_1 WHERE Table_1.column_1 = (SELECT * /* subquery begins */ FROM Table_2 WHERE Table_2.column_1 = 5);
4.
Comparison Operators in
Subqueries ❖ All ❖ Any ❖ Some ❖ In
5.
Example
6.
Cont. With Subquery
(ALL): Find max salary and empno using Subquery in single table.
7.
cont. Without Subquery
(ALL):
8.
cont. Without Subquery
(Any):
9.
cont. With Subquery
(All):
10.
Group By And
Having Clauses Example Showing How Group By and Having Differs:
11.
cont. Group by:
12.
cont. Having: