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 8 Question 30 Discussion

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

The tables "s1" and "s2" are defined below. The column "id" for tables "s1" and "s2" is of INTEGER type. The column "enable" for table "s1" is of BOOLEAN type, and the column "name" for table "s2" is of TEXT type.

s1: id |

enable

----+--------

1 | t 2 | f

s2: id |

name ----

+------ 1 |

post 2 |

gre 3 |

SQL

The following SQL was executed. Select the correct number of rows in the result. SELECT * FROM s2 WHERE id IN (SELECT id FROM s1);

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Tanja
1 months ago
Ah, the old 'SQL query with a twist' trick, eh? I bet the exam writers had a field day coming up with this one. Imagine if the tables were named 'table1' and 'table2' instead - the confusion would be off the charts! But hey, at least they kept the column names simple. 'id' and 'name' - no fancy stuff here. Just good old-fashioned SQL goodness.
upvoted 0 times
...
Desmond
2 months ago
This is a classic SQL query, but with a twist! I love these types of questions. Let me break it down... The 's1' table has 2 rows, and the 's2' table has 3 rows. The IN clause will only return the rows from 's2' that have an id matching the ids in 's1'. So, the correct answer is B) 2 rows. Easy peasy!
upvoted 0 times
Sylvia
7 days ago
Exactly, that's why the correct answer is 2 rows.
upvoted 0 times
...
Hortencia
28 days ago
So, it will only return 'post' and 'gre' from 's2'.
upvoted 0 times
...
Goldie
29 days ago
Yeah, I agree. The query will only return the rows from 's2' that have matching ids in 's1'.
upvoted 0 times
...
Lourdes
1 months ago
I think the answer is B) 2 rows.
upvoted 0 times
...
...
Rhea
2 months ago
Hmm, this one's a bit tricky. I'm going to have to carefully examine the data in the tables to figure this out. Ah, I see now! There are 2 rows in 's1' with ids 1 and 2, and the 's2' table has 3 rows with ids 1, 2, and 3. The IN clause will only return the matching rows, so the correct answer is B) 2 rows.
upvoted 0 times
...
Annice
2 months ago
Ah, a classic SQL query with a subquery! I just love these types of questions. Let me think this through... The 's1' table has 2 rows, and the 's2' table has 3 rows. The IN clause will only return the rows from 's2' that have an id matching the ids in 's1'. So, the correct answer is B) 2 rows.
upvoted 0 times
Sheridan
8 days ago
No, it's definitely B) 2 rows.
upvoted 0 times
...
Yvonne
17 days ago
I think it's C) 3 rows.
upvoted 0 times
...
Sol
28 days ago
I agree, the answer is B) 2 rows.
upvoted 0 times
...
...
Virgilio
3 months ago
The key to this question is understanding the relationship between the two tables. Since the 'id' column in both tables is of INTEGER type, we can use the IN clause to find the matching ids. Given the data in the tables, there are 2 rows in 's1' table, and 3 rows in 's2' table that have matching ids. Therefore, the correct answer is B) 2 rows.
upvoted 0 times
Mohammad
1 months ago
Therefore, the correct answer is B) 2 rows.
upvoted 0 times
...
Soledad
2 months ago
So, there are 2 rows in 's1' and 3 rows in 's2' with matching ids.
upvoted 0 times
...
Linwood
2 months ago
Yes, you're right. The correct answer is B) 2 rows.
upvoted 0 times
...
Noe
2 months ago
I think the answer is B) 2 rows.
upvoted 0 times
...
Asha
2 months ago
I agree, the key is to use the IN clause to find matching ids.
upvoted 0 times
...
Salena
2 months ago
I think the answer is B) 2 rows.
upvoted 0 times
...
...
Vicente
3 months ago
I'm not sure, but I think the answer might be C) 3 rows.
upvoted 0 times
...
Evette
3 months ago
I agree with Nancey, because there are 2 matching ids in s1 and s2.
upvoted 0 times
...
Nancey
3 months ago
I think the answer is B) 2 rows.
upvoted 0 times
...

Save Cancel