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 89 Discussion

Actual exam question for PostgreSQL's PGCES-02 exam
Question #: 89
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:

INSERT INTO custom SELECT max(id) + 1, 'ddd@example.com', 4

FROM custom; UPDATE custom SET introducer = 999 WHERE email = 'bbb@example.com'; DELETE FROM custom WHERE introducer NOT IN (SELECT id FROM custom); Select the number of rows in the "custom" table after the execution.

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

0/2000 characters
Noemi
2 months ago
I disagree, I think it’ll end up with 4 rows.
upvoted 0 times
...
Sharika
2 months ago
Definitely 2 rows, the DELETE will remove one.
upvoted 0 times
...
Sabina
2 months ago
Wait, how can there be 0 rows? That seems off!
upvoted 0 times
...
An
3 months ago
Looks like there will be 2 rows left after those operations.
upvoted 0 times
...
Hollis
3 months ago
I think it’s actually 3 rows.
upvoted 0 times
...
William
3 months ago
I believe the DELETE will remove rows that don't have valid introducers, but I'm confused about how many rows that would be after the UPDATE.
upvoted 0 times
...
Francoise
3 months ago
I feel like after the DELETE, we might end up with fewer rows, but I can't recall exactly how many would be left.
upvoted 0 times
...
Zona
4 months ago
I remember a similar question where we had to track changes in a table. I think the UPDATE might not change the row count, but the DELETE could remove some rows.
upvoted 0 times
...
Frank
4 months ago
I think the INSERT statement adds a new row, but I'm not sure how the DELETE affects the total count after that.
upvoted 0 times
...
Delila
4 months ago
This is a good example of needing to carefully trace the impact of multiple SQL statements. I'll make sure to walk through each one systematically to arrive at the correct answer.
upvoted 0 times
...
Paz
4 months ago
I'm a bit confused by the DELETE statement. How does it determine which rows to remove based on the introducer column? I'll need to double-check that part.
upvoted 0 times
...
Detra
4 months ago
Okay, I think I've got it. The INSERT statement adds a new row, the UPDATE statement changes one row, and the DELETE statement removes one row. So the final result should be 3 rows.
upvoted 0 times
...
Helga
4 months ago
Hmm, the key seems to be understanding how the DELETE statement will work with the introducer column. I'll need to think through the logic there.
upvoted 0 times
...
Glen
5 months ago
This looks like a tricky SQL question. I'll need to carefully walk through each step to make sure I understand the impact of the statements.
upvoted 0 times
...

Save Cancel