New Year Sale 2026! 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

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

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;

Show Suggested Answer Hide Answer
Suggested Answer: E

Contribute your Thoughts:

0/2000 characters
Lenita
5 days 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.
upvoted 0 times
...
Chanel
10 days 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.
upvoted 0 times
...
Casey
15 days 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.
upvoted 0 times
...
Davida
20 days 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.
upvoted 0 times
...
Hester
25 days 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.
upvoted 0 times
...
Evangelina
1 month 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.
upvoted 0 times
...
Marcos
1 month 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.
upvoted 0 times
...

Save Cancel