+ 1

Can we specify aggregate operators in WHERE cluase

SQL Queries aggregate operators

22nd Nov 2020, 2:48 PM
🎶💞Sravs💞🥀
🎶💞Sravs💞🥀 - avatar
8 odpowiedzi
+ 1
Can you elaborate further on your goal and the idea behind the use of aggregate operator in WHERE clause?
22nd Nov 2020, 3:47 PM
Ipang
+ 1
MIN,MAX,COUNT,AVG,SUM are aggregate operators
22nd Nov 2020, 3:58 PM
🎶💞Sravs💞🥀
🎶💞Sravs💞🥀 - avatar
+ 1
Yes I know that too, I mean what are you trying to achieve by using any of those? can you tell me that please?
22nd Nov 2020, 4:05 PM
Ipang
+ 1
SELECT name FROM sailors WHERE age = MIN(age) Does that make sense?
22nd Nov 2020, 4:52 PM
Ipang
+ 1
Yes you wrote in correct way
11th Dec 2020, 6:58 AM
🎶💞Sravs💞🥀
🎶💞Sravs💞🥀 - avatar
0
Find the name of youngest sailor
22nd Nov 2020, 4:50 PM
🎶💞Sravs💞🥀
🎶💞Sravs💞🥀 - avatar
0
Ipang maybe it is dependent on the SQL engine, but I think "WHERE age = MIN(age)" woul not work properly. I would expect it to require a subselect: WHERE age = (SELECT Min(age) FROM sailors)
22nd Nov 2020, 10:43 PM
Brian
Brian - avatar
0
In WHERE class by using other query we specify the aggregate operators
11th Dec 2020, 6:59 AM
🎶💞Sravs💞🥀
🎶💞Sravs💞🥀 - avatar