Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

PostgreSQL Exam PGCES-02 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:

Carry
2 days 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
8 days 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
...
Junita
9 days 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
10 days ago
I disagree, I believe the answer is D) 3 rows.
upvoted 0 times
...
Junita
13 days ago
I think the answer is C) 2 rows.
upvoted 0 times
...

Save Cancel