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 in Database by Kithuzzz
• 12,240 points
32 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
648 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 in Database by Kithuzzz
• 12,240 points
28 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,380 points
313 views
0 votes
1 answer

SQL Server: PARTITION BY vs GROUP BY

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

answered Feb 9 in Database by Neha
• 8,920 points
541 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 in Database by Vaani
• 7,020 points
33 views
0 votes
1 answer

Group by Sum in Excel

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

answered Feb 21 in Database by gaurav
• 18,960 points
92 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,000 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,630 points
935 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,280 points
360 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