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 PGCES-02 Exam - Topic 1 Question 37 Discussion

Posted by Alishia on Dec 27, 2022 at 12:15 AM

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.

Suggested Answer: A

Get Premium PGCES-02 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
38 comments · newest first
TA
Taryn 11 months ago
How can there be 4 rows left? That seems off!
EU
Eun 11 months ago
Definitely 1 row, the updates and deletes make sense.
GE
German 12 months ago
Wait, are you sure? I thought the deletes would clear more out.
NO
Nobuko 12 months ago
I think it should be 2 rows after all that.
SH
Shannon 12 months ago
Looks like the final count will be 1 row.
NA
Nan 1 year 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?
HA
Hannah 1 year ago
The second update could nullify some introducers, but I can't recall if that would lead to any deletions in the last step.
MA
Marica 1 year 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.
IL
Ilene 1 year 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.
NO
Nohemi 1 year 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.
WI
Winfred 1 year 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.
LA
Lawana 1 year 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.
CL
Claribel 1 year 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.
LE
Leota 1 year 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!
JA
Jaclyn 1 year ago
↳ replying to Leota
I'm pretty sure there will be 0 rows left in the table.
CE
Celeste 1 year ago
↳ replying to Leota
I believe only 1 row will remain in the table.
TW
Twana 1 year ago
↳ replying to Leota
I think after the execution, there will be 2 rows left in the table.
CH
Chery 1 year 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.
WY
Wynell 1 year ago
↳ replying to Chery
I agree with E) 4 rows. The SQL statements don't actually delete any rows, so the original 4 rows should still be there.
AH
Ahmed 1 year ago
↳ replying to Chery
I'm going with C) 2 rows. The SQL statements update and delete rows, so the final table should have 2 rows.
RU
Rueben 1 year ago
↳ replying to Chery
I believe the answer is B) 1 row. The UPDATE statements change the data, so there should be only 1 row left after execution.
KA
Karon 1 year ago
↳ replying to Chery
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.
DA
Davida 1 year ago
↳ replying to Chery
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.
AN
Anna 1 year ago
↳ replying to Chery
I'm going with C) 2 rows. The DELETE statement removes 2 rows, leaving 2 rows in the table.
AY
Ayesha 1 year ago
↳ replying to Chery
I believe it's B) 1 row. The UPDATE statements change the data, but the DELETE statement only removes 1 row.
LY
Lynette 1 year ago
↳ replying to Chery
I think it's A) 0 rows. The DELETE statement removes rows where id = 2 or introducer = 2, which would remove 2 rows.
RO
Robt 1 year 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.
MA
Matthew 1 year ago
↳ replying to Robt
I agree with you, C) 2 rows makes sense. The last statement is the only one that actually deletes rows.
ST
Stefania 1 year ago
↳ replying to Robt
I think the answer is C) 2 rows. The last statement deletes 2 rows, so there should be 2 rows left.
CA
Carry 1 year 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.
LE
Leah 2 years 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.
TO
Toshia 1 year ago
↳ replying to Leah
Finally, the third statement deletes specific rows, leaving us with 2 rows.
MA
Marguerita 1 year ago
↳ replying to Leah
Then the second statement sets introducer to NULL for non-matching introducers.
AN
Antonio 1 year ago
↳ replying to Leah
I agree, the first statement updates the email column to empty for matching introducer.
VE
Vernice 1 year ago
↳ replying to Leah
I think the correct answer is C) 2 rows.
JU
Junita 2 years ago
But if you look at the SQL statements carefully, it seems like only 2 rows will remain after the execution.
IS
Isreal 2 years ago
I disagree, I believe the answer is D) 3 rows.
JU
Junita 2 years ago
I think the answer is C) 2 rows.
0/2000 characters

Save Cancel