New Year Sale ! 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 1 Question 77 Discussion

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

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.

Show Suggested Answer Hide Answer
Suggested Answer: E

Contribute your Thoughts:

Shawna
21 days ago
I'd go with D. Dropping a column that's part of the primary key has got to cause an error, right?
upvoted 0 times
Aleisha
10 days ago
A) An error occurs when executing the (1) SQL statement.
upvoted 0 times
...
...
Jules
25 days ago
But the UNIQUE constraint should be added to a column, not the table itself. So, I think an error occurs when executing the (3) SQL statement.
upvoted 0 times
...
Gianna
26 days ago
Haha, dropping the 'bar' column? That's a bold move, let's see if it works!
upvoted 0 times
Martina
13 days ago
User2: No error is generated.
upvoted 0 times
...
Delfina
14 days ago
User1: I think an error occurs when executing the (4) SQL statement.
upvoted 0 times
...
...
Ona
28 days ago
I believe no error is generated.
upvoted 0 times
...
Glen
1 months ago
Hmm, I'm not sure. Maybe the (2) statement would cause an error since you can't add a column to a table that already has data in it.
upvoted 0 times
...
Vivienne
1 months ago
I think the answer is E. No error is generated. The table has been modified successfully, and the data remains intact.
upvoted 0 times
Amina
3 days ago
I agree, the table has been modified successfully.
upvoted 0 times
...
Lenna
22 days ago
I think the answer is E. No error is generated.
upvoted 0 times
...
...
Jules
1 months ago
I think an error occurs when executing the (3) SQL statement.
upvoted 0 times
...

Save Cancel