BLACK FRIDAY SALE – Unlock Up to 25% OFF on All Exam Prep! - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

PostgreSQL PGCES-02 Exam - Topic 10 Question 90 Discussion

Posted by Vanna on Aug 18, 2025 at 12:09 PM

The table "score" is defined as follows:

gid | score

-----+-------

1 | 70 1 |

60 2 | 100

3 | 80 3 |

50

The following query was executed. Select the number of rows in the result.

SELECT gid, max(score) FROM score GROUP BY gid HAVING max(score) > 60;

Suggested Answer: C

Get Premium PGCES-02 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
22 comments · newest first
NA
Natalie 11 months ago
Definitely 2 rows, no doubt about it!
MA
Ma 11 months ago
Wait, are you sure? I thought gid 1 would count too.
TI
Tijuana 11 months ago
There are 3 unique gids in the table.
BR
Brett 12 months ago
Gid 1 has a max score of 70, so it should be included!
CH
Cherry 12 months ago
I think it’s 2 rows, only gid 2 and 3 have max scores > 60.
LO
Lorriane 1 year ago
If I recall correctly, gid 2 and gid 3 should both return max scores over 60, so that would be 2 rows, right?
SA
Samira 1 year ago
I’m a bit confused about the HAVING clause. Does it filter out groups that don’t meet the score condition?
SO
Solange 1 year ago
I remember practicing a similar question, and I think there were two groups with max scores above 60.
CH
Cherelle 1 year ago
I think the query groups by gid and then checks for max scores over 60, but I'm not sure how many actually meet that condition.
SC
Scarlet 1 year ago
Wait, I'm a little confused. Does the HAVING clause apply to the entire result set, or just to the groups? I want to make sure I'm interpreting that correctly before answering.
RA
Raul 1 year ago
Alright, I got this. The key is recognizing that the HAVING clause is filtering the groups, so I just need to count how many of those filtered groups there are. Easy peasy.
LE
Leigha 1 year ago
This looks straightforward enough. I'll just need to count the number of distinct gid values that have a max score greater than 60. Should be a pretty quick one to solve.
RE
Reyes 1 year ago
Okay, I can see the table structure and the query, but I'm a bit unsure about how the HAVING clause works here. I'll need to double-check my understanding of that before answering.
RO
Ronnie 1 year ago
Hmm, let me think this through. The query is grouping by gid and selecting the maximum score for each group, but only keeping the groups where the max score is greater than 60. So I'll need to carefully analyze the data to determine how many groups meet that criteria.
LI
Ling 1 year ago
I'm not sure, but I think the answer might be C) 3 rows.
JE
Jesusita 1 year ago
Hmm, this seems pretty straightforward. I'm going with B) 2 rows.
RO
Rory 10 months ago
↳ replying to Jesusita
I agree with Mona, B) 2 rows makes sense!
RE
Renato 11 months ago
↳ replying to Jesusita
I’m leaning towards C) 3 rows.
MO
Mona 11 months ago
↳ replying to Jesusita
No way, it's definitely B) 2 rows.
ER
Ernest 11 months ago
↳ replying to Jesusita
I think it's A) 1 row.
EL
Elenora 1 year ago
I agree with Dante, because there are 2 rows with a max score greater than 60.
DA
Dante 1 year ago
I think the answer is B) 2 rows.
0/2000 characters

Save Cancel