nerdexam
PostgreSQL_CE

PGCES-02 · Question #135

The table "foo" is defined as follows: CREATE TABLE foo (bar TEXT); Next, four SQL statements were executed in the following order. INSERT INTO foo VALUES ('bar'); -------- (1) ALTER TABLE foo ADD COL

The correct answer is E. No error is generated.. See the full explanation below for the reasoning.

Question

The table "foo" is defined as follows:

CREATE TABLE foo (bar TEXT); Next, four SQL statements were executed in the following order. INSERT INTO foo VALUES ('bar'); -------- (1) ALTER TABLE foo ADD COLUMN c1 TEXT; ---- (2) ALTER TABLE foo ADD UNIQUE (c1); ------- (3) ALTER TABLE foo DROP COLUMN bar; ------- (4) Select the correct statement from those below.

Options

  • AAn error occurs when executing the (1) SQL statement.
  • BAn error occurs when executing the (2) SQL statement.
  • CAn error occurs when executing the (3) SQL statement.
  • DAn error occurs when executing the (4) SQL statement.
  • ENo error is generated.

How the community answered

(42 responses)
  • A
    2% (1)
  • B
    5% (2)
  • C
    2% (1)
  • D
    14% (6)
  • E
    76% (32)

Community Discussion

No community discussion yet for this question.

Full PGCES-02 Practice