New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

PostgreSQL PGCES-02 Exam - Topic 8 Question 57 Discussion

Actual exam question for PostgreSQL's PGCES-02 exam
Question #: 57
Topic #: 8
[All PGCES-02 Questions]

The "sample" table consists of the following data: How many rows are returned by executing the following SQL statement? SELECT DISTINCT ON (data) * FROM sample;

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

0/2000 characters
Corrie
3 months ago
Not sure about this one, could be more than 5 rows too!
upvoted 0 times
...
Nguyet
3 months ago
Yeah, I agree with Sage, 3 sounds right.
upvoted 0 times
...
Dacia
3 months ago
Wait, how can it be 4 rows? That seems off.
upvoted 0 times
...
Twana
4 months ago
Definitely 2 rows!
upvoted 0 times
...
Sage
4 months ago
I think it returns 3 rows.
upvoted 0 times
...
Walton
4 months ago
I’m leaning towards option A, but I can't recall if DISTINCT ON counts all duplicates or just the first occurrence. This is tricky!
upvoted 0 times
...
Jutta
4 months ago
I feel like I might be overthinking this. If the sample table has 4 rows total and 2 of them are duplicates, maybe it returns 3?
upvoted 0 times
...
Paris
4 months ago
I remember practicing a question like this, and I think it was about counting unique rows. If there are 3 unique values, then it should return 3 rows, right?
upvoted 0 times
...
Corrina
5 months ago
I think the DISTINCT ON clause will return only unique values based on the "data" column, but I'm not sure how many unique values we have in the sample table.
upvoted 0 times
...
Selma
5 months ago
This is a good SQL question to test our understanding of the DISTINCT ON clause. I think I've got a handle on it, so I'll give it my best shot.
upvoted 0 times
...
Franchesca
5 months ago
I'm a bit confused by the DISTINCT ON syntax here. I'll need to review some examples to make sure I understand how it works before answering this.
upvoted 0 times
...
Marguerita
5 months ago
Okay, let me break this down step-by-step. The DISTINCT ON clause will return the first row for each unique value in the "data" column. So I just need to count the number of unique "data" values to get the answer.
upvoted 0 times
...
Bettina
5 months ago
Hmm, this looks like a tricky SQL question. I'll need to think through the DISTINCT ON clause carefully to figure out how many unique rows it will return.
upvoted 0 times
...
Alpha
5 months ago
Ah, the DISTINCT ON statement - a classic SQL gotcha. I'll need to carefully consider the data structure to determine the number of unique rows returned.
upvoted 0 times
...
Malissa
5 months ago
Okay, let me see here. I think the CMDB Use Case Modelar might be the right choice, since it's specifically focused on managing CIs and use cases. But I'm not 100% sure, so I'll need to double-check the details.
upvoted 0 times
...
Della
5 months ago
The key here is that we need to sign out users from the primary location, so I think the answer is going to be either A or B. I'll try to remember the differences between those two cmdlets.
upvoted 0 times
...
Janessa
5 months ago
This seems like a straightforward question about securing PDF reports. I think I'll go with option C - selecting the 'Secure this Report' option in the report properties.
upvoted 0 times
...
Iesha
10 months ago
This question is making my head spin! I'm going to go with my gut and choose A. 2 rows. Gotta love those tricky SQL queries, am I right?
upvoted 0 times
Leonida
9 months ago
I'm going with 5 rows, it seems like the most logical choice.
upvoted 0 times
...
Cassie
9 months ago
I'm pretty sure it's 4 rows, not 2 or 3.
upvoted 0 times
...
Clorinda
9 months ago
I think it's actually 3 rows, not 2.
upvoted 0 times
...
...
Bea
10 months ago
E) 6 rows? Really? That can't be right. I'm sticking with B. 3 rows. It's the most logical answer based on the DISTINCT ON clause.
upvoted 0 times
Jeannetta
9 months ago
I'm not sure about 4 rows. I think it might be 3 rows because DISTINCT ON will return unique values.
upvoted 0 times
...
Craig
9 months ago
I agree with you. I also think it's 4 rows. The DISTINCT ON clause will eliminate duplicates.
upvoted 0 times
...
Kris
9 months ago
I think it's 4 rows. The DISTINCT ON clause will return unique values based on the 'data' column.
upvoted 0 times
...
...
Eden
10 months ago
Haha, this question is a classic SQL brain-teaser! I'm going with C. 4 rows. Let's see if I can outsmart the exam writers.
upvoted 0 times
...
Norah
10 months ago
Oh, I was sure it was D. 5 rows. But now I'm not so sure. I need to review my SQL basics again.
upvoted 0 times
Rossana
8 months ago
I think it might be 6 rows.
upvoted 0 times
...
Glory
9 months ago
I remember it being 2 rows.
upvoted 0 times
...
Andree
9 months ago
I'm pretty sure it's 3 rows.
upvoted 0 times
...
Allene
10 months ago
I think it's actually 4 rows.
upvoted 0 times
...
...
Quiana
10 months ago
I think the correct answer is B. 3 rows. The DISTINCT ON clause will return the first row for each distinct value of the 'data' column.
upvoted 0 times
Jesus
9 months ago
I think it might be C. 4 rows.
upvoted 0 times
...
Jesus
9 months ago
I agree, the answer is B. 3 rows.
upvoted 0 times
...
...
Joseph
10 months ago
I agree with Catalina, the answer is C) 4 rows. The DISTINCT ON clause will return unique values based on the specified column.
upvoted 0 times
...
Catalina
11 months ago
I disagree, I believe the answer is C) 4 rows because DISTINCT ON eliminates duplicates.
upvoted 0 times
...
Darrin
11 months ago
I think the answer is B) 3 rows.
upvoted 0 times
...

Save Cancel