Free PGCES-02 Exam Braindumps (page: 4)

Page 4 of 36

Table "t1" is defined below.
Table "t1" has a column "id" of type INTEGER, and a column "name" of type TEXT.
t1:
The following SQL is executed while client "A" is connected. BEGIN;
SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
SELECT * FROM t1 WHERE id = 1 FOR UPDATE; -- (*)
While the second 'SELECT' statement, shown with (*), is being executed, a separate client "B" connects and executes the following SQL.
Select the correct statement about the execution results.
UPDATE t1 SET name = 'turtle' WHERE id = 2;
Note: the default transaction isolation level is set to "read committed".

  1. The update process for client "B" is blocked until the current connection for client "A" is
    finished.
  2. The update process for client "B" is blocked until the current transaction for client "A" is
    finished.
  3. The 'UPDATE' process for client "B" proceeds regardless of the condition of client "A".
  4. The process of client "B" immediately generates an error.
  5. The processes for both clients are blocked, and an error stating that a deadlock has been
    detected is generated.

Answer(s): B



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.

  1. INSERT INTO ftrans VALUES (1, 1, CURRENT_DATE);
  2. INSERT INTO ftrans VALUES (2, 1, '2007-07-07');
  3. UPDATE fmaster SET name = 'itemAX' WHERE id = 1;
  4. UPDATE fmaster SET id = 100 WHERE id = 1;
  5. UPDATE ftrans SET id = 200 WHERE id = 1;

Answer(s): A,C



Select three SQL statements which return NULL.

  1. SELECT 0 = NULL;
  2. SELECT NULL != NULL;
  3. SELECT NULL IS NULL;
  4. SELECT NULL;
  5. SELECT 'null'::TEXT;

Answer(s): A,B,D



The table "custom" is defined below.
The "id" column and "introducer" column are of INTEGER type, and the "email" column is of TEXT type.

id | email | introducer
----+-----------------+------------
2 | aaa@example.com | 1
3 | bbb@example.com | 2
4 | ccc@example.com | 2
Three SQL statements were executed in the following order: INSERT INTO custom
SELECT max(id) + 1, 'ddd@example.com', 4 FROM custom;
UPDATE custom SET introducer = 999
WHERE email = 'bbb@example.com';
DELETE FROM custom
WHERE introducer NOT IN (SELECT id FROM custom);
Select the number of rows in the "custom" table after the execution.

  1. 0 rows
  2. 1 row
  3. 2 rows
  4. 3 rows
  5. 4 rows

Answer(s): C



Page 4 of 36



Post your Comments and Discuss Postgresql PGCES-02 exam with other Community members:

Gabe commented on January 02, 2020
easy check out
UNITED STATES
upvote