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:

Chery
16 hours 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
...
Robt
8 days 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
...
Carry
11 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
17 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
18 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
19 days ago
I disagree, I believe the answer is D) 3 rows.
upvoted 0 times
...
Junita
22 days ago
I think the answer is C) 2 rows.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77