SlideShare a Scribd company logo
PRESTIGE INSTITUTE OF MANAGEMENT
GWALIOR
Presented by- Arpit bhadoriya
BCA 2nd
(B)
Syntax for SELECT statement
• Clauses must be written in the following order
▫ SELECT
▫ FROM
▫ WHERE
▫ GROUP BY
▫ HAVING
▫ ORDER BY
SELECT clause
▫ The main element in a SQL query is the SELECT
statement.
▫ Figure out what values will actually be included in the
final result set by processing the SELECT clause.
▫ A properly written SELECT statement will always
produce a result in the form of one or more rows of
output.
▫ The SELECT statement chooses (selects) rows from
one or more tables according to specific criteria.
FROM clause
▫ FROM clause is used to specify the table name on
which we want to perform the operation.
▫ Without a table name, the database management
system does not know which table to query.
Example
Select *
From student;
• This query selects rows from the “student” table.
• The asterisk (*) tells SQL to select (display) all columns
contained in the table “student”.
WHERE clause
▫ Specific rows can be selected by adding a WHERE
clause to the SELECT query
If the result of the WHERE clause for that row is
TRUE then the row is kept. If the result of the
WHERE clause for that row is FALSE then the row
is "thrown away".
Example
select *
from student
where stu_id=2
Stu_id Stu_name Stu_add
2 Bhupendra Tansen nagar
GROUP BY
▫ The function to divide the tuples into groups and
returns an aggregate for each group .
▫ Usually, it is an aggregate function’s companion.
Example
419pizza
500hotdog
totalSoldfood
70pizza06/06/13
500hotdog06/06/13
349pizza06/05/13
soldfooddate
SELECT food, sum(sold) as totalSold
FROM Foodchart
group by food;
FoodChart
HAVING
▫ The substitute of WHERE for aggregate functions
▫ Usually, it is an aggregate function’s companion
SELECT food, sum(sold) as totalSold
FROM Foodchart
group by food
having sum(sold) > 450;
500hotdog
totalSoldfood
70pizza06/06/13
500hotdog06/06/13
349pizza06/05/13
soldfooddate
ORDER BY
▫ Sort the result set in the order specified in the
ORDER BY clause
▫ To sort columns from high to low or low to high ,
keyword ASC and DESC must be specified.
ASC - Ascending, low to high
DESC - Descending, high to low
When ASC or DESC is used, it must be followed by the column
name
Example
Select *
From student
Order by stu_add ASC
Stu_id Stu_name Stu_add
1 arpit adityapuram
3 abhishek D d nagar
2 bhupendra Tansen nagar
WHERE VS HAVING
• Similarities:
▫ The WHERE and HAVING clauses are both used to
exclude records from the result set.
• Differences
▫ WHERE clause
 The WHERE clause is processed before the groups are created
 Therefore, the WHERE clause can refer to any value in the
original tables
▫ HAVING clause
 The HAVING clause is processed after the groups are created
 The HAVING clause CANNOT refer to individual columns
from a table that are not also part of the group.
SQL select clause
Ad

More Related Content

What's hot (20)

SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
Vikas Gupta
 
Sql operators & functions 3
Sql operators & functions 3Sql operators & functions 3
Sql operators & functions 3
Dr. C.V. Suresh Babu
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
Raveena Thakur
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
VARSHAKUMARI49
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
programmings guru
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
Hammad Rasheed
 
SQL
SQLSQL
SQL
Vineeta Garg
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
Wings Interactive
 
Sql select
Sql select Sql select
Sql select
Mudasir Syed
 
Using the set operators
Using the set operatorsUsing the set operators
Using the set operators
Syed Zaid Irshad
 
joins in database
 joins in database joins in database
joins in database
Sultan Arshad
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
SomeshwarMoholkar
 
Triggers in SQL | Edureka
Triggers in SQL | EdurekaTriggers in SQL | Edureka
Triggers in SQL | Edureka
Edureka!
 
MYSQL join
MYSQL joinMYSQL join
MYSQL join
Ahmed Farag
 
Oraclesql
OraclesqlOraclesql
Oraclesql
Priya Goyal
 
AGGREGATE FUNCTION.pptx
AGGREGATE FUNCTION.pptxAGGREGATE FUNCTION.pptx
AGGREGATE FUNCTION.pptx
Anusha sivakumar
 
Aggregate function
Aggregate functionAggregate function
Aggregate function
Rayhan Chowdhury
 
Sql clauses by Manan Pasricha
Sql clauses by Manan PasrichaSql clauses by Manan Pasricha
Sql clauses by Manan Pasricha
MananPasricha
 
Sql join
Sql  joinSql  join
Sql join
Vikas Gupta
 

Similar to SQL select clause (20)

Unit 3-Select Options and Aggregate Functions in SQL (1).pptx
Unit 3-Select Options and Aggregate Functions in SQL (1).pptxUnit 3-Select Options and Aggregate Functions in SQL (1).pptx
Unit 3-Select Options and Aggregate Functions in SQL (1).pptx
HAMEEDHUSSAINBU21CSE
 
Structure query language, database course
Structure query language, database courseStructure query language, database course
Structure query language, database course
yunussufyan2024
 
retrieving data using SQL statements
retrieving data using SQL statementsretrieving data using SQL statements
retrieving data using SQL statements
Arun Nair
 
MySQL Pro
MySQL ProMySQL Pro
MySQL Pro
NexThoughts Technologies
 
Difference between group by and order by in sql server
Difference between group by and  order by in sql serverDifference between group by and  order by in sql server
Difference between group by and order by in sql server
Umar Ali
 
Subqueries, Backups, Users and Privileges
Subqueries, Backups, Users and PrivilegesSubqueries, Backups, Users and Privileges
Subqueries, Backups, Users and Privileges
Ashwin Dinoriya
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Training
bixxman
 
Les18
Les18Les18
Les18
Vijay Kumar
 
Group by clause mod
Group by clause modGroup by clause mod
Group by clause mod
Nitesh Singh
 
Sql query [select, sub] 4
Sql query [select, sub] 4Sql query [select, sub] 4
Sql query [select, sub] 4
Dr. C.V. Suresh Babu
 
Les04
Les04Les04
Les04
Sudharsan S
 
5. Group Functions
5. Group Functions5. Group Functions
5. Group Functions
Evelyn Oluchukwu
 
sqltutorialbasiccommands-130310014513-phpapp01.pdf
sqltutorialbasiccommands-130310014513-phpapp01.pdfsqltutorialbasiccommands-130310014513-phpapp01.pdf
sqltutorialbasiccommands-130310014513-phpapp01.pdf
pradeepvunnam2
 
SQL Lesson 6 - Select.pdf
SQL Lesson 6 - Select.pdfSQL Lesson 6 - Select.pdf
SQL Lesson 6 - Select.pdf
Madhusha15
 
e computer notes - Enhancements to the group by clause
e computer notes - Enhancements to the group by clausee computer notes - Enhancements to the group by clause
e computer notes - Enhancements to the group by clause
ecomputernotes
 
MySQL basics
MySQL basicsMySQL basics
MySQL basics
Jamshid Hashimi
 
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
SQL QueriesSQL Queries
SQL Queries
Nilt1234
 
Updat Dir
Updat DirUpdat Dir
Updat Dir
guest319770
 
Sql server 2016 queries
Sql server 2016 queriesSql server 2016 queries
Sql server 2016 queries
Seyed Ibrahim
 
Unit 3-Select Options and Aggregate Functions in SQL (1).pptx
Unit 3-Select Options and Aggregate Functions in SQL (1).pptxUnit 3-Select Options and Aggregate Functions in SQL (1).pptx
Unit 3-Select Options and Aggregate Functions in SQL (1).pptx
HAMEEDHUSSAINBU21CSE
 
Structure query language, database course
Structure query language, database courseStructure query language, database course
Structure query language, database course
yunussufyan2024
 
retrieving data using SQL statements
retrieving data using SQL statementsretrieving data using SQL statements
retrieving data using SQL statements
Arun Nair
 
Difference between group by and order by in sql server
Difference between group by and  order by in sql serverDifference between group by and  order by in sql server
Difference between group by and order by in sql server
Umar Ali
 
Subqueries, Backups, Users and Privileges
Subqueries, Backups, Users and PrivilegesSubqueries, Backups, Users and Privileges
Subqueries, Backups, Users and Privileges
Ashwin Dinoriya
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Training
bixxman
 
Group by clause mod
Group by clause modGroup by clause mod
Group by clause mod
Nitesh Singh
 
sqltutorialbasiccommands-130310014513-phpapp01.pdf
sqltutorialbasiccommands-130310014513-phpapp01.pdfsqltutorialbasiccommands-130310014513-phpapp01.pdf
sqltutorialbasiccommands-130310014513-phpapp01.pdf
pradeepvunnam2
 
SQL Lesson 6 - Select.pdf
SQL Lesson 6 - Select.pdfSQL Lesson 6 - Select.pdf
SQL Lesson 6 - Select.pdf
Madhusha15
 
e computer notes - Enhancements to the group by clause
e computer notes - Enhancements to the group by clausee computer notes - Enhancements to the group by clause
e computer notes - Enhancements to the group by clause
ecomputernotes
 
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
SQL QueriesSQL Queries
SQL Queries
Nilt1234
 
Sql server 2016 queries
Sql server 2016 queriesSql server 2016 queries
Sql server 2016 queries
Seyed Ibrahim
 
Ad

Recently uploaded (20)

Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Building Connected Agents:  An Overview of Google's ADK and A2A ProtocolBuilding Connected Agents:  An Overview of Google's ADK and A2A Protocol
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Suresh Peiris
 
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
SOFTTECHHUB
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
TrustArc Webinar: Cross-Border Data Transfers in 2025
TrustArc Webinar: Cross-Border Data Transfers in 2025TrustArc Webinar: Cross-Border Data Transfers in 2025
TrustArc Webinar: Cross-Border Data Transfers in 2025
TrustArc
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdfICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
DNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in NepalDNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in Nepal
ICT Frame Magazine Pvt. Ltd.
 
Right to liberty and security of a person.pdf
Right to liberty and security of a person.pdfRight to liberty and security of a person.pdf
Right to liberty and security of a person.pdf
danielbraico197
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
Best 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat PlatformsBest 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat Platforms
Soulmaite
 
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Vasileios Komianos
 
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
UXPA Boston
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
AI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptxAI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptx
Shikha Srivastava
 
Scientific Large Language Models in Multi-Modal Domains
Scientific Large Language Models in Multi-Modal DomainsScientific Large Language Models in Multi-Modal Domains
Scientific Large Language Models in Multi-Modal Domains
syedanidakhader1
 
Accommodating Neurodiverse Users Online (Global Accessibility Awareness Day 2...
Accommodating Neurodiverse Users Online (Global Accessibility Awareness Day 2...Accommodating Neurodiverse Users Online (Global Accessibility Awareness Day 2...
Accommodating Neurodiverse Users Online (Global Accessibility Awareness Day 2...
User Vision
 
Cybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft CertificateCybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft Certificate
VICTOR MAESTRE RAMIREZ
 
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
Toru Tamaki
 
Understanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdfUnderstanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdf
Fulcrum Concepts, LLC
 
Is Your QA Team Still Working in Silos? Here's What to Do.
Is Your QA Team Still Working in Silos? Here's What to Do.Is Your QA Team Still Working in Silos? Here's What to Do.
Is Your QA Team Still Working in Silos? Here's What to Do.
marketing943205
 
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Building Connected Agents:  An Overview of Google's ADK and A2A ProtocolBuilding Connected Agents:  An Overview of Google's ADK and A2A Protocol
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Suresh Peiris
 
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
SOFTTECHHUB
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
TrustArc Webinar: Cross-Border Data Transfers in 2025
TrustArc Webinar: Cross-Border Data Transfers in 2025TrustArc Webinar: Cross-Border Data Transfers in 2025
TrustArc Webinar: Cross-Border Data Transfers in 2025
TrustArc
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdfICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
Right to liberty and security of a person.pdf
Right to liberty and security of a person.pdfRight to liberty and security of a person.pdf
Right to liberty and security of a person.pdf
danielbraico197
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
Best 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat PlatformsBest 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat Platforms
Soulmaite
 
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Vasileios Komianos
 
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
UXPA Boston
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
AI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptxAI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptx
Shikha Srivastava
 
Scientific Large Language Models in Multi-Modal Domains
Scientific Large Language Models in Multi-Modal DomainsScientific Large Language Models in Multi-Modal Domains
Scientific Large Language Models in Multi-Modal Domains
syedanidakhader1
 
Accommodating Neurodiverse Users Online (Global Accessibility Awareness Day 2...
Accommodating Neurodiverse Users Online (Global Accessibility Awareness Day 2...Accommodating Neurodiverse Users Online (Global Accessibility Awareness Day 2...
Accommodating Neurodiverse Users Online (Global Accessibility Awareness Day 2...
User Vision
 
Cybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft CertificateCybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft Certificate
VICTOR MAESTRE RAMIREZ
 
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
Toru Tamaki
 
Understanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdfUnderstanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdf
Fulcrum Concepts, LLC
 
Is Your QA Team Still Working in Silos? Here's What to Do.
Is Your QA Team Still Working in Silos? Here's What to Do.Is Your QA Team Still Working in Silos? Here's What to Do.
Is Your QA Team Still Working in Silos? Here's What to Do.
marketing943205
 
Ad

SQL select clause

  • 1. PRESTIGE INSTITUTE OF MANAGEMENT GWALIOR Presented by- Arpit bhadoriya BCA 2nd (B)
  • 2. Syntax for SELECT statement • Clauses must be written in the following order ▫ SELECT ▫ FROM ▫ WHERE ▫ GROUP BY ▫ HAVING ▫ ORDER BY
  • 3. SELECT clause ▫ The main element in a SQL query is the SELECT statement. ▫ Figure out what values will actually be included in the final result set by processing the SELECT clause. ▫ A properly written SELECT statement will always produce a result in the form of one or more rows of output. ▫ The SELECT statement chooses (selects) rows from one or more tables according to specific criteria.
  • 4. FROM clause ▫ FROM clause is used to specify the table name on which we want to perform the operation. ▫ Without a table name, the database management system does not know which table to query.
  • 5. Example Select * From student; • This query selects rows from the “student” table. • The asterisk (*) tells SQL to select (display) all columns contained in the table “student”.
  • 6. WHERE clause ▫ Specific rows can be selected by adding a WHERE clause to the SELECT query If the result of the WHERE clause for that row is TRUE then the row is kept. If the result of the WHERE clause for that row is FALSE then the row is "thrown away".
  • 7. Example select * from student where stu_id=2 Stu_id Stu_name Stu_add 2 Bhupendra Tansen nagar
  • 8. GROUP BY ▫ The function to divide the tuples into groups and returns an aggregate for each group . ▫ Usually, it is an aggregate function’s companion.
  • 10. HAVING ▫ The substitute of WHERE for aggregate functions ▫ Usually, it is an aggregate function’s companion SELECT food, sum(sold) as totalSold FROM Foodchart group by food having sum(sold) > 450; 500hotdog totalSoldfood 70pizza06/06/13 500hotdog06/06/13 349pizza06/05/13 soldfooddate
  • 11. ORDER BY ▫ Sort the result set in the order specified in the ORDER BY clause ▫ To sort columns from high to low or low to high , keyword ASC and DESC must be specified. ASC - Ascending, low to high DESC - Descending, high to low When ASC or DESC is used, it must be followed by the column name
  • 12. Example Select * From student Order by stu_add ASC Stu_id Stu_name Stu_add 1 arpit adityapuram 3 abhishek D d nagar 2 bhupendra Tansen nagar
  • 13. WHERE VS HAVING • Similarities: ▫ The WHERE and HAVING clauses are both used to exclude records from the result set. • Differences ▫ WHERE clause  The WHERE clause is processed before the groups are created  Therefore, the WHERE clause can refer to any value in the original tables ▫ HAVING clause  The HAVING clause is processed after the groups are created  The HAVING clause CANNOT refer to individual columns from a table that are not also part of the group.
  翻译: