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 1 Question 37 Discussion

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

The table "custom" is defined below. The "id" column and "introducer" column are of

INTEGER type, and the "email" column is of TEXT type.

id | email | introducer ----+-- ---------------+-----------2 |

aaa@example.com | 1 3 |

bbb@example.com | 2 4 |

ccc@example.com | 2

Three SQL statements were executed in the following order:

UPDATE custom SET email = '' FROM custom c WHERE

custom.introducer = c.id; UPDATE custom SET introducer = NULL

WHERE introducer NOT IN (SELECT id FROM custom); DELETE

FROM custom WHERE id = 2 OR introducer = 2; Select the number of rows in the "custom" table after the execution.

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Taryn
4 months ago
How can there be 4 rows left? That seems off!
upvoted 0 times
...
Eun
4 months ago
Definitely 1 row, the updates and deletes make sense.
upvoted 0 times
...
German
5 months ago
Wait, are you sure? I thought the deletes would clear more out.
upvoted 0 times
...
Nobuko
5 months ago
I think it should be 2 rows after all that.
upvoted 0 times
...
Shannon
5 months ago
Looks like the final count will be 1 row.
upvoted 0 times
...
Nan
5 months ago
I feel like the delete statement will remove a lot of rows, especially since id 2 and its introducer are involved. Maybe we end up with 0 rows?
upvoted 0 times
...
Hannah
5 months ago
The second update could nullify some introducers, but I can't recall if that would lead to any deletions in the last step.
upvoted 0 times
...
Marica
5 months ago
I remember a similar question where we had to count rows after multiple updates and deletes. I think we might end up with 1 or 2 rows left.
upvoted 0 times
...
Ilene
5 months ago
I think the first update will set the emails to empty for rows with introducers, but I'm not sure how that affects the next steps.
upvoted 0 times
...
Nohemi
5 months ago
I'm pretty sure the Service Agent pattern would apply to Reliable Messaging and Asynchronous Queuing, but I'm not as confident about the other two options.
upvoted 0 times
...
Winfred
5 months ago
Okay, I've got this. If the resource owner allows access, the authorization server sends the OAuth client a redirection. That's the next step in the three-legged OAuth2 process. I'm confident that's the right answer.
upvoted 0 times
...
Lawana
5 months ago
I'm a bit confused on the differences between profile caching and profile streaming. I'll need to review those features more closely to determine the best fit.
upvoted 0 times
...
Claribel
6 months ago
Okay, the key details here are the default remote user access requirements. I think I need to focus on configuring the console access and default remote user role.
upvoted 0 times
...
Leota
11 months ago
Ah, the good old 'UPDATE, UPDATE, DELETE' dance. It's like a SQL ballet, with a tragic ending for row 2. I hope the other rows make it out alive!
upvoted 0 times
Jaclyn
10 months ago
I'm pretty sure there will be 0 rows left in the table.
upvoted 0 times
...
Celeste
10 months ago
I believe only 1 row will remain in the table.
upvoted 0 times
...
Twana
10 months ago
I think after the execution, there will be 2 rows left in the table.
upvoted 0 times
...
...
Chery
11 months ago
Hmm, this is a tricky one. I'm going to go with E) 4 rows. The SQL statements don't seem to delete any rows, they just update the data. So the final table should still have the original 4 rows.
upvoted 0 times
Wynell
9 months ago
I agree with E) 4 rows. The SQL statements don't actually delete any rows, so the original 4 rows should still be there.
upvoted 0 times
...
Ahmed
9 months ago
I'm going with C) 2 rows. The SQL statements update and delete rows, so the final table should have 2 rows.
upvoted 0 times
...
Rueben
9 months ago
I believe the answer is B) 1 row. The UPDATE statements change the data, so there should be only 1 row left after execution.
upvoted 0 times
...
Karon
9 months ago
I think the answer is A) 0 rows. The DELETE statement removes rows where id = 2 or introducer = 2, so it should delete 2 rows.
upvoted 0 times
...
Davida
9 months ago
I agree with E) 4 rows. The SQL statements update data but do not delete any rows, so the table should still have 4 rows.
upvoted 0 times
...
Anna
10 months ago
I'm going with C) 2 rows. The DELETE statement removes 2 rows, leaving 2 rows in the table.
upvoted 0 times
...
Ayesha
10 months ago
I believe it's B) 1 row. The UPDATE statements change the data, but the DELETE statement only removes 1 row.
upvoted 0 times
...
Lynette
10 months ago
I think it's A) 0 rows. The DELETE statement removes rows where id = 2 or introducer = 2, which would remove 2 rows.
upvoted 0 times
...
...
Robt
11 months ago
D) 3 rows seems like the right answer to me. The first two statements don't actually delete any rows, they just update the email and introducer columns. The third statement only removes 2 rows, so there should be 3 rows left.
upvoted 0 times
Matthew
10 months ago
I agree with you, C) 2 rows makes sense. The last statement is the only one that actually deletes rows.
upvoted 0 times
...
Stefania
10 months ago
I think the answer is C) 2 rows. The last statement deletes 2 rows, so there should be 2 rows left.
upvoted 0 times
...
...
Carry
11 months ago
I'm going with B) 1 row. The third statement deletes the row with id = 2 and all rows where the introducer is 2, which means there should only be 1 row left in the table.
upvoted 0 times
...
Leah
11 months ago
I think the correct answer is C) 2 rows. The first statement updates the email column to empty for all rows where the introducer matches the id. The second statement sets the introducer to NULL for all rows where the introducer is not in the id column. The third statement deletes the row with id = 2 and all rows where the introducer is 2. This leaves us with 2 rows in the table.
upvoted 0 times
Toshia
10 months ago
Finally, the third statement deletes specific rows, leaving us with 2 rows.
upvoted 0 times
...
Marguerita
10 months ago
Then the second statement sets introducer to NULL for non-matching introducers.
upvoted 0 times
...
Antonio
10 months ago
I agree, the first statement updates the email column to empty for matching introducer.
upvoted 0 times
...
Vernice
10 months ago
I think the correct answer is C) 2 rows.
upvoted 0 times
...
...
Junita
11 months ago
But if you look at the SQL statements carefully, it seems like only 2 rows will remain after the execution.
upvoted 0 times
...
Isreal
11 months ago
I disagree, I believe the answer is D) 3 rows.
upvoted 0 times
...
Junita
11 months ago
I think the answer is C) 2 rows.
upvoted 0 times
...

Save Cancel