HAVING without GROUP BY

0 votes
  • Does the following make sense in terms of normal(!) SQL?
  • What minor adjustments are required to bring something into compliance with the standard, if it isn't already?
  • If the first row contains the maximum value for NumberOfPages, MySQL behaves as expected.

SELECT * FROM Book HAVING NumberOfPages = MAX(NumberOfPages)

The following is written in the standard:

HAVING <search condition>

  • Let G be the set consisting of every column referenced by a <column reference> contained in the <group by clause>.
  • Each column reference directly contained in the <search condition> shall be one of the following:
    1. An unambiguous reference to a column that is functionally dependent on G.
    2. An outer reference.

 Can somebody explain me, why it should be possible according to the standard?

Aug 21, 2022 in Database by Kithuzzz
• 38,020 points
1,245 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
1 answer

What is the rule to use group by, having and where clause?

Hi samar, this is a very common mistake ...READ MORE

answered Jul 2, 2019 in Database by anonymous
1,235 views
0 votes
0 answers

Execution sequence of Group By, Having and Where clause in SQL Server?

I'm just not sure how a SQL ...READ MORE

Aug 19, 2022 in Database by Kithuzzz
• 38,020 points
534 views
0 votes
1 answer

What is GROUP BY statement in MySQL?

This statement is used with the aggregate ...READ MORE

answered Nov 23, 2018 in Database by Sahiti
• 6,370 points
624 views
0 votes
1 answer

SQL Server: PARTITION BY vs GROUP BY

To understand the differences between GROUP BY ...READ MORE

answered Feb 9, 2022 in Database by Neha
• 9,060 points
2,548 views
0 votes
1 answer

SQL Group By with an Order By

In any version of MySQL, you can use the aggregate ...READ MORE

answered Feb 10, 2022 in Database by Vaani
• 7,070 points
500 views
0 votes
1 answer

Group by Sum in Excel

It is very easy and you can ...READ MORE

answered Feb 21, 2022 in Database by gaurav
• 23,260 points
548 views
0 votes
1 answer

Which query to use for better performance, join in SQL or using Dataset API?

DataFrames and SparkSQL performed almost about the ...READ MORE

answered Apr 19, 2018 in Apache Spark by kurt_cobain
• 9,390 points
1,734 views
0 votes
1 answer

How to connect Java program to the MySQL database?

You can connect your Java code with ...READ MORE

answered May 11, 2018 in Java by Parth
• 4,640 points
1,854 views
0 votes
1 answer
0 votes
1 answer

Automating Oracle script with nolio

Depending upon the details of your script ...READ MORE

answered Jul 17, 2018 in Other DevOps Questions by ajs3033
• 7,300 points
975 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP