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 4 Question 95 Discussion

Posted by Larae on Jan 28, 2026 at 06:04 AM

Select the correct result generated by execution of the following SQL statements:

CREATE TABLE log (id int, message TEXT, logtime TIMESTAMP); CREATE

TABLE log_01 () INHERITS (log);

INSERT INTO log_01 VALUES (1, 'error', CURRENT_TIMESTAMP);

SELECT * FROM log;

Suggested Answer: E

Get Premium PGCES-02 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
26 comments · newest first
AM
Amos 3 months ago
Still, SELECT * from log shows no rows.
BE
Bette 3 months ago
But it inherits from log, right?
TH
Theron 3 months ago
Agreed, log_01 is empty.
LA
Lashawna 4 months ago
I think it will show nothing.
CA
Carman 5 months ago
It should show the inserted row in log_01, right?
HO
Hortencia 5 months ago
I thought you couldn't select from the parent table like that?
DE
Deandrea 5 months ago
Wait, does log_01 actually have the data from log?
NA
Nakisha 6 months ago
Totally agree, the inheritance is key here!
JO
Jonell 6 months ago
The log table is created first.
EL
Elenora 6 months ago
Wait, is this a trick question? I'm so confused, but I'm going to go with the empty result set too. Gotta play it safe, you know?
KE
Keith 6 months ago
Haha, this question is like a game of SQL Jeopardy! I'm going to go with the empty result set just to be safe.
VI
Vilma 6 months ago
I think the question is trying to trick us. The data should be in the log table since it's being inserted into the child table log_01.
AI
Ailene 6 months ago
Hmm, I'm not sure about that. Shouldn't the data be visible in the parent table log as well?
FR
Frederica 7 months ago
The correct result is an empty result set, as the data is inserted into the child table log_01 and not the parent table log.
JO
Johana 7 months ago
I believe the log table won't show the inserted row since it only exists in log_01. I hope I remember this correctly!
AI
Aileen 7 months ago
This reminds me of a practice question where we had to deal with table inheritance. I feel like the output will be empty too, but I can't recall the exact details.
LE
Lenita 8 months ago
I'm not entirely sure, but I remember something about inheritance in SQL. The data might not show up in the parent table since the insert was done in the child table.
CH
Chanel 8 months ago
I think the SELECT statement will return an empty result because we are selecting from the parent table, and we haven't inserted anything into it.
CA
Casey 8 months ago
Alright, let me walk through this step-by-step. We create the 'log' table, then create 'log_01' as a child table that inherits from 'log'. When we insert into 'log_01', that data gets propagated up to the parent 'log' table. So the SELECT should return the row we inserted. I think I've got the right approach here.
DA
Davida 8 months ago
I think I've got this. Since 'log_01' inherits from 'log', any rows inserted into 'log_01' will also be visible in the 'log' table. So the SELECT * FROM log; should return the row we inserted into 'log_01'. Feeling pretty confident about this one.
HE
Hester 8 months ago
I'm a bit confused on the table inheritance part. Does that mean the data in 'log_01' will automatically show up in the 'log' table? I'll need to review how that works before answering this.
EV
Evangelina 9 months ago
Okay, let's see here. We're creating a table 'log' and then creating a child table 'log_01' that inherits from it. Then we insert a row into 'log_01'. The question is asking what the SELECT * FROM log; will return. Interesting, let me work this through.
MA
Marcos 9 months ago
Hmm, this looks like a question on inheritance and polymorphism in SQL. I'll need to think through how the table inheritance works and how the data gets propagated.
JA
Jacklyn 2 months ago
↳ replying to Marcos
I think it should, since log_01 inherits from log.
DA
Daniela 3 months ago
↳ replying to Marcos
Right? I wonder if the data from log_01 shows up in log.
LA
Lawana 3 months ago
↳ replying to Marcos
Inheritance in SQL can be tricky!
0/2000 characters

Save Cancel