nerdexam
PostgreSQL_CE

PGCES-02 · Question #87

SQL statements were executed in the following order: CREATE TABLE fmaster (id INTEGER PRIMARY KEY, name TEXT); CREATE TABLE ftrans (id INTEGER REFERENCES fmaster (id), stat INTEGER, date DATE)…

The correct answer is A. INSERT INTOftrans VALUES (1, 1, CURRENT_DATE); C. UPDATEfmaster SET name = 'itemAX' WHERE id = 1. See the full explanation below for the reasoning.

Question

SQL statements were executed in the following order:

CREATE TABLE fmaster (id INTEGER PRIMARY KEY, name TEXT); CREATE TABLE ftrans (id INTEGER REFERENCES fmaster (id), stat INTEGER, date DATE); INSERT INTO fmaster VALUES (1, 'itemA'); INSERT INTO ftrans VALUES (1, 1, CURRENT_DATE); Select two SQL statements that will generate an error when executed next.

Options

  • AINSERT INTOftrans VALUES (1, 1, CURRENT_DATE);
  • BINSERT INTOftrans VALUES (2, 1, '2007-07-07');
  • CUPDATEfmaster SET name = 'itemAX' WHERE id = 1;
  • DUPDATEfmaster SET id = 100 WHERE id = 1;
  • EUPDATEftrans SET id = 200 WHERE id = 1;

How the community answered

(32 responses)
  • A
    75% (24)
  • B
    3% (1)
  • D
    6% (2)
  • E
    16% (5)

Community Discussion

No community discussion yet for this question.

Full PGCES-02 Practice