Вы находитесь на странице: 1из 37

Exam Name: PostgreSQL CE 8 Silver

Exam Type: PostgreSQL CE


Exam Code: PGCES-02 Total Questions: 142

Question: 1
Select two suitable statements regarding the following SQL statement:
CREATE TRIGGER trigger_1 AFTER UPDATE ON sales FOR EACH ROW
EXECUTE PROCEDURE write_log();

A. It is defining a trigger "trigger_1".


B. Every time 'UPDATE' is executed on the "sales" table, the "write_log" function is called once.
C. The "write_log" function is called before 'UPDATE' takes place.
D. 'UPDATE' is not executed if "write_log" returns NULL.
E. 'DROP TRIGGER trigger_1 ON sales;' deletes the defined trigger.

Answer: A, E

Question: 2
Select two transaction isolation levels supported in PostgreSQL.

A. DIRTY READ
B. READ COMMITTED
C. REPEATABLE READ
D. PHANTOM READ
E. SERIALIZABLE

Answer: B, E

Question: 3
PostgreSQL can use an index to access a table. Select two incorrect statements about indexes.

A. An index is created by 'CREATE INDEX', and deleted by 'DROP INDEX'.


B. By using an index effectively, searching and sorting performs faster.
C. There are B-tree, Hash, R-tree and GiST index types.
D. By creating an index, performance always improves.
E. Creating an unused index does not affect the performance of a database at all.

Answer: D, E

Question: 4
Select two incorrect statements regarding 'DOMAIN'.

A. When defining a domain, you can add a default value and constraints to the original data.
B. Domain is a namespace existing between databases and objects such as tables.
C. A domain is created by 'CREATE DOMAIN'.
D. A domain can be used as a column type when defining a table.
E. To define a domain, both input and output functions are required.

Answer: B, E

Question: 5
Select two suitable statements regarding the data types of PostgreSQL.

A. One field can handle up to 1GB of data.


B. 'n' in CHARACTER(n) represents the number of bytes.
C. Only the INTEGER type can be declared as an array.
D. There is a non-standard PostgreSQL data type, called Geometric data type, which handles 2-
dimensional data.
E. A large object data type can be used to store data of unlimited size.

Page 1 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Answer: A, D

Question: 6
The table "score" is defined as follows:

gid | score
-----+-------
1 | 70
1 | 60
2 | 100
3 | 80
3 | 50

The following query was executed. Select the number of rows in the result.
SELECT gid, max(score) FROM score
GROUP BY gid HAVING max(score) > 60;

A. 1 row
B. 2 rows
C. 3 rows
D. 4 rows
E. 5 rows

Answer: C

Question: 7
Table "t1" is defined as follows:
CREATE TABLE t1 (value VARCHAR(5));
A set of SQL statements were executed in the following order. Select the number of rows that
table "t1" has after execution.
BEGIN;
INSERT INTO t1 VALUES ('AA');
SAVEPOINT point1;
INSERT INTO t1 VALUES ('BB');
SAVEPOINT point2;
INSERT INTO t1 VALUES ('CC');
ROLLBACK TO point1;
INSERT INTO t1 VALUES ('DD');
END;

A. 1 row
B. 2 rows
C. 3 rows
D. 4 rows
E. 0 rows

Answer: B

Question: 8
Select two suitable statements about sequences.

A. A sequence always returns a 4-byte INTEGER type value, so the maximum value is
2147483647.
B. A sequence is defined by 'CREATE SEQUENCE', and deleted by 'DROP SEQUENCE'.

Page 2 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

C. Although the "nextval" function is called during a transaction, it will have no effect if that
transaction is rolled back.
D. A sequence always generates 0 or consecutive positive numbers.
E. A sequence number can be set by calling the "setval" function.

Answer: B, E

Question: 9
The "sample" table consists of the following data:
How many rows are returned by executing the following SQL statement?
SELECT DISTINCT ON (data) * FROM sample;

A. 2 rows
B. 3 rows
C. 4 rows D. 5 rows
E. 6 rows

Answer: B

Question: 10
The following SQL statements were executed using psql.
Select the appropriate statement about the result.
LISTEN sign_v;
BEGIN;
NOTIFY sign_v;
COMMIT;
LISTEN sign_v;

A. At the point that 'NOTIFY sign_v' is executed, a message that starts with "Asynchronous
notification 'sign_v' received" is output.
B. At the point that 'COMMIT' is executed, a message that starts with "Asynchronous notification
'sign_v' received" is output.
C. At the point that 'SELECT * FROM pg_user;" is executed, a message that starts with
"Asynchronous notification 'sign_v' received" is output.
D. When 'LISTEN sign_v' is executed for the second time, a message that starts with
"Asynchronous notification 'sign_v' received" is output.
E. The message "Asynchronous notification 'sign_v' received" is not received while in this
connection.

Answer: B

Question: 11
Select the correct SQL statement which concatenates strings 'ABC' and 'abc' to form 'ABCabc'.

A. SELECT 'ABC' . 'abc';


B. SELECT cat('ABC', 'abc') FROM pg_operator;
C. SELECT 'ABC' + 'abc';
D. SELECT 'ABC' + 'abc' FROM pg_operator;
E. SELECT 'ABC' || 'abc';

Answer: E

Question: 12
Select two correct descriptions about views.

Page 3 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

A. A view is created by 'DECLARE VIEW', and deleted by 'DROP VIEW'.


B. A view is a virtual table which does not exist.
C. A view is created to simplify complicated queries.
D. You can create a view with the same name as already existing tables.
E. A view only exists while the postmaster is running, and is deleted when the postmaster stops.

Answer: B, C

Question: 13
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".

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

Answer: B

Question: 14
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.

A. INSERT INTO ftrans VALUES (1, 1, CURRENT_DATE);


B. INSERT INTO ftrans VALUES (2, 1, '2007-07-07');
C. UPDATE fmaster SET name = 'itemAX' WHERE id = 1;
D. UPDATE fmaster SET id = 100 WHERE id = 1;
E. UPDATE ftrans SET id = 200 WHERE id = 1;

Answer: A, C

Question: 15
Select three SQL statements which return NULL.

A. SELECT 0 = NULL;

Page 4 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

B. SELECT NULL != NULL;


C. SELECT NULL IS NULL;
D. SELECT NULL;
E. SELECT 'null'::TEXT;

Answer: A, B, D

Question: 16
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.

A. 0 rows
B. 1 row
C. 2 rows
D. 3 rows
E. 4 rows

Answer: C

Question: 17
The "sample" table consists of the following data:
How many rows are returned by executing the following SQL statement?
SELECT * FROM sample WHERE v ~ 'ab';

A. 0 rows
B. 1 row
C. 2 rows
D. 3 rows
E. 4 rows

Answer: C

Question: 18
Select an incorrect statement regarding the following SQL statement. Note that "user_view" is a
view.
CREATE OR REPLACE RULE rule_1 AS ON UPDATE TO user_view
DO INSTEAD NOTHING;

A. It is defining a rule "rule_1".

Page 5 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

B. It will replace "rule_1" if it already exists.


C. Executing 'UPDATE user_view' will no longer output errors.
D. When executing 'UPDATE user_view', data is updated in the table that is the origin of the
view.
E. 'DROP RULE rule_1 ON user_view' deletes the above definition.

Answer: D

Question: 19
The "animal" table consists of the following data:
Select the correct result returned by executing the following SQL statement:
SELECT name FROM animal ORDER BY weight DESC LIMIT 2 OFFSET 1;
A. A syntax error will occur.

Answer: A

Question: 20
Four SQL statements were executed in the following order.
CREATE TABLE foo (bar INT);
ALTER TABLE foo ALTER bar TYPE BIGINT;
ALTER TABLE foo ADD baz VARCHAR(5);
ALTER TABLE foo DROP bar;
Select two SQL statements that generate an error when executed.

A. INSERT INTO foo VALUES ('12345');


B. INSERT INTO foo VALUES ('5000000000');
C. INSERT INTO foo VALUES ('ABC');
D. INSERT INTO foo VALUES (2000000000);
E. INSERT INTO foo VALUES (NULL);

Answer: B, D

Question: 21
A table named "sample" is defined as below. Select two statements which will generate a
constraint error.
CREATE TABLE sample (
i INTEGER PRIMARY KEY,
j INTEGER,
CHECK ( i > 0 AND j < 0 )
);

A. INSERT INTO sample VALUES (1, 0);


B. INSERT INTO sample VALUES (2, -2);
C. INSERT INTO sample VALUES (3, NULL);
D. INSERT INTO sample VALUES (NULL, -4);
E. INSERT INTO sample VALUES (5, -5);

Answer: A, D

Question: 22
The following is the result of executing the createlang command which is installed with
PostgreSQL.
$ createlang -U postgres --list mydb
Procedural Languages
Name | Trusted?

Page 6 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

---------+----------
plpgsql | yes
Select two correct statements from below.

A. The procedural language plpgsql is installed in the database mydb using the above command.
B. The procedural language plpgsql can be used in the database mydb.
C. plpgsql is a trusted language, so it can execute the OS commands on the server side.
D. plpgsql is a trusted language, so it can read/write OS files on the server side.
E. plpgsql is a safe language with restricted operations.

Answer: B, E

Question: 23
Given the following two table definitions, select one SQL statement which will cause an error.
CREATE TABLE sample1 (id INTEGER, data TEXT);
CREATE TABLE sample2 (id INTEGER);

A. SELECT id AS data, data FROM sample1;


B. SELECT id, id FROM sample1;
C. SELECT s1.id, s2.id FROM sample1 AS s1, sample1 AS s2;
D. SELECT s1.id, s2.id FROM sample1 s1, sample2 s2;
E. SELECT s1.id, s2.data FROM sample1 s1, sample2 s2;

Answer: E

Question: 24
Select two suitable statements regarding creating a new table.

A. There is no upper limit to the number of columns in a table.


B. A newly created table is empty and has 0 rows.
C. You can only use alphabetic characters for a table name.
D. The row name must be within 16 characters.
E. The SQL 'CREATE TABLE' statement is used to create a new table.

Answer: B, E

Question: 25
The tables "t1" and "t2" are defined below.
The tables "t1" and "t2" have columns "id" which are type of INTEGER and column "name"s
which are type of TEXT.
t1
t2
The following SQL command was executed. Select the number of rows in the result.
SELECT * FROM t1 NATURAL FULL OUTER JOIN t2;

A. 2 rows
B. 3 rows
C. 4 rows
D. 5 rows
E. 6 rows

Answer: D

Question: 26
Select two suitable statements about major version upgrades of PostgreSQL from below.

Page 7 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

A. You can use the databases of the old major version.


B. To use the data from the old version, you only need to replace the program.
C. To use the data from the old version, you need to conduct a backup and restore.
D. There is a possibility of configuration parameter changes after major version upgrades.
E. Upgrade scripts can be executed while the old version of PostgreSQL is running.

Answer: C, D

Question: 27
Select one incorrect statement concerning the relational data model.

A. It expresses the real world in a collection of 2-dimensional tables called a relation.


B. It is a model based on set theory.
C. It has a logical structure independent of physical data structure.
D. It is made up of a multiple stage hierarchy where each of the set elements has parent child
relationships.
E. It is a model that was proposed by E.F. Codd in 1970.

Answer: D

Question: 28
Select two incorrect statements concerning PostgreSQL license.

A. It can be used freely.


B. It can be duplicated freely.
C. It can be freely redistributed.
D. Developers are responsible for its maintenance support.
E. Developers are only responsible for handling its crucial faults.

Answer: D, E

Question: 29
Select the most suitable statement about PostgreSQL from below.

A. PostgreSQL is a card-type database management system.


B. PostgreSQL is a hierarchical database management system.
C. PostgreSQL is a network-type database management system.
D. PostgreSQL is an XML database management system.
E. PostgreSQL is a relational database management system.

Answer: E

Question: 30
Select the most suitable statement about the PostgreSQL license from below.

A. PostgreSQL is distributed under the GPL license.


B. PostgreSQL is distributed under the PostgreSQL license.
C. PostgreSQL is distributed under the LGPL license.
D. PostgreSQL is distributed under the BSD license.
E. PostgreSQL is distributed under the X11(MIT) license.

Answer: D

Question: 31

Page 8 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Select one incorrect statement regarding psql.

A. psql is an interactive SQL interpreter that enables a user to enter queries.


B. For system security, only the PostgreSQL administrator account is allowed to use psql.
C. "psql -l" displays a database list.
D. "psql -U jan" will connect to the database called jan.
E. Commands that begin with a backslash are processed internally in psql.

Answer: B

Question: 32
I would like to insert the contents of the text file users.dat into the table t1 using psql.
Contents of text file users.dat:
Definition of table t1:
CREATE TABLE t1 (uname TEXT, pass TEXT, id INTEGER);
Select the most appropriate input from those below.

A. \copy t1 FROM users.dat WITH DELIMITER ':'


B. \copy t1 TO users.dat WITH DELIMITER ':'
C. INSERT INTO t1 FROM file('users.dat');
D. INSERT INTO t1 SELECT uname, pass, id FROM file('users.dat');
E. \insert t1 FROM users.dat WITH DELIMITER ':';

Answer: A

Question: 33
Select one correct statement about the createlang command.

A. It is a command for setting the locale for a database.


B. It is a command for registering a procedural language into a database.
C. It is a command for creating a user defined function.
D. It is a command for adding message catalogs.
E. It is a command that has been discarded for version 8 and later.

Answer: B

Question: 34
What does the following command do? Select two correct descriptions regarding this SQL
statement.
SELECT * FROM information_schema.tables;

A. Requests a list of defined tables in the currently connected database.


B. Requests a list of defined tables in the "information_schema" database.
C. Requests the contents of the "tables" table in the "information_schema" database.
D. Requests the contents of the "tables" table in the "information_schema" schema.
E. Requests a list of defined tables in the "information_schema" schema.

Answer: A, D

Question: 35
Select two correct statements that describe what occurs on the client side when the following
command is executed.
pg_ctl -m smart stop

A. Clients will not be able to make new connections.

Page 9 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

B. The running transaction for a connected client is rolled back and the connection is
disconnected forcibly.
C. Connections are terminated after the currently running transactions have finished.
D. The processes of currently connected clients are processed normally.
E. Connected clients receive a message saying that the server will soon be shutdown.

Answer: A, D

Question: 36
Select two correct statements about the command shown below.
Note: $ is the command prompt.
$ pg_ctl reload

A. The command forces the content of pg_hba.conf to be re-read into PostgreSQL server
process.
B. The command temporarily stops the PostgreSQL server process and restart it.
C. The command re-reads the postgresql.conf details into the PostgreSQL server process and
changes the values of any configuration parameters that can be changed.
D. The command forces the content of the database cluster to be re-read into PostgreSQL
server process.
E. The command causes a recovery to be performed from a standard backup file in the
PostgreSQL server process.

Answer: A, C

Question: 37
I would like to set the default character encoding for the client to Unicode.
Select the most appropriate configuration parameter in postgresql.conf from those below.

A. backend_encoding = UNICODE
B. frontend_encoding = UNICODE
C. client_encoding = UNICODE
D. default_encoding = UTF8
E. encoding = UTF8

Answer: C

Question: 38
Select two correct statements about the command shown below.
Note: $ is the command prompt.
$ dropdb -U foo foodb

A. If foo doesn't have the OS superuser privilege, an error will occur.


B. If any table definition remains in database foodb, an error will occur.
C. This command removes database foodb.
D. This command removes all of the objects inside the database foodb.
E. The same process can be performed using the SQL command "DROP DATABASE".

Answer: C, E

Question: 39
I would like to copy a database cluster directory for backup.
Select two incorrect statements from below.

A. The directory must be copied after stopping the database server.

Page 10 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

B. When using the Tablespace function, it is necessary to back up the directory that stores the
tablespace as well.
C. A database cluster that has been restored can be used on a separate machine with the same
structure.
D. A database cluster that has been restored can be used on a newer version of PostgreSQL.
E. A database cluster that has been restored can be used on an older version of PostgreSQL.

Answer: D, E

Question: 40
Select the correct command to collect and save the statistical information of a table.

A. ANALYZE
B. CLUSTER
C. REINDEX
D. STATISTIC COLLECTION
E. STATISTIC COLLECTOR

Answer: A

Question: 41
Choose the most suitable statement about user management of PostgreSQL.
Note: the version of PostgreSQL is 8.0.

A. Usernames not registered in the operating system cannot be registered as PostgreSQL


users.
B. To create a new user for PostgreSQL, the "newuser" command is used.
C. PostgreSQL cannot be in a state where multiple users exist at the same time.
D. If you create a user that has permission to create other users, that user will become a
superuser that is not subject to any access restriction checks.
E. To delete an existing user for PostgreSQL, "deleteuser" command is used.

Answer: D

Question: 42
I would like to enable all users to SELECT the "item" table.
Select the most appropriate SQL statement from below.

A. GRANT public SELECT ON item;


B. GRANT SELECT ON item TO public;
C. REVOKE 'r' ON item TO public;
D. REVOKE READ ON item TO public;
E. REVOKE public SELECT ON item;

Answer: B

Question: 43
Configuration file pg_hda.conf is set as below on a host currently running
PostgreSQL.
local all all trust
host all all 192.168.1.0/24 reject
host all all 192.168.0.0/16 trust
Select a host IP address which is authorized to connect to this database via the network.
Note: INET domain socket communication is available.

Page 11 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

A. 127.0.0.1
B. 192.168.1.1
C. 192.168.0.1
D. 192.168.1.0
E. None can be connected.

Answer: C

Question: 44
Select one correct command to shutdown the postmaster AFTER all the clients have
disconnected.

A. pg_ctl stop
B. pg_ctl -m fast stop
C. pg_ctl -m immediate stop
D. pg_ctl -m wait stop
E. pg_ctl -s stop

Answer: A

Question: 45
Select the most appropriate setting to output the log messages of the database to syslog.

A. "syslog = true" in postgresql.conf.


B. "log_destination = 0" in postgresql.conf.
C. "log_destination = 1" in postgresql.conf.
D. "log_destination = 2" in postgresql.conf.
E. "log_destination = syslog" in postgresql.conf.

Answer: E

Question: 46
Select one option which cannot be specified using createdb.

A. Database locale
B. Character encoding
C. Host name
D. Database owner
E. Template database

Answer: A

Question: 47
You have just added an option "listen_addresses = 'localhost'" in
postgresql.conf. When will this setting take effect?

A. This change will take effect as soon as postgresql.conf is saved.


B. This change will take effect by executing "pg_ctl reload".
C. This change will take effect by executing "pg_ctl restart".
D. This change will take effect after rebooting the OS, because the new option is recorded as an
OS parameter.
E. This setting is invalid unless the change is made while postmaster is stopped.

Answer: C

Page 12 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Question: 48
Select two suitable statements regarding the pg_dump command.

A. pg_dump is an SQL command.


B. Only the user who executed initdb can execute pg_dump.
C. pg_dump can create a backup while postmaster is running.
D. pg_dump can create a backup while postmaster is stopped.
E. pg_dump can create a backup of a specified table.

Answer: C, E

Question: 49
Based on the following request, select the most appropriate command for creating a database
cluster.
?Character encoding of the template database needs to be EUC_JP
?Locale is not used

A. initdb --locale=EUC_JP --no-encoding


B. initdb --default-encoding=EUC_JP
C. pg_ctl init --locale=EUC_JP
D. initdb --encoding=EUC_JP --no-locale
E. pg_ctl init --encoding=EUC_JP

Answer: D

Question: 50
Select the correct SQL statement that records the space occupied by deleted or updated rows for
later reuse, and also updates statistics.

A. VACUUM
B. VACUUM ANALYZE
C. EXPLAIN
D. EXPLAIN ANALYZE
E. NOTIFY

Answer: B

Question: 51
A sequence has the following definition:
CREATE SEQUENCE seq1 CACHE 10 CYCLE;
Select the value that is returned by executing the following SQL.
SELECT nextval('seq1');

A. 0
B. 1
C. 10
D. 11
E. -10

Answer: B

Question: 52
A table and view are defined as follows:
CREATE TABLE item (id INT, name TEXT, description TEXT);
CREATE VIEW item_simple AS SELECT id, name FROM item;

Page 13 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

A set of SQL statements were executed in the order below. Select the most appropriate
statement concerning the execution results.
BEGIN;
SELECT * FROM item_simple;
INSERT INTO item_simple VALUES (1, 'item_name_1');
UPDATE item_simple SET name = 'item_name_2' WHERE id = 1;
DELETE FROM item_simple;
END;

A. An error is generated at the point the SELECT statement is executed.


B. An error is generated at the point the INSERT statement is executed.
C. An error is generated at the point the UPDATE statement is executed.
D. An error is generated at the point the DELETE statement is executed.
E. No error is generated.

Answer: B

Question: 53
The present time is noon of July 7th, 2007, and the result of the following
SQL sentence was '2007-07-17 12:00:00'.
Select the correct expression to fill in the blank below.
SELECT CURRENT_TIMESTAMP::timestamp + ________________ ;

A. '10 day'::timestamp
B. '10 day'::interval
C. 10::day
D. 8640000::time
E. age(8640000)

Answer: B

Question: 54
You want to set a constraint so that the "item_id" in the "sales" table will always have a value that
already exists as "id" in the "item_master" table. Select the correct SQL statement to fill in the
underlined blank of the "sales" table. Definitions:
CREATE TABLE item_master (
id INTEGER PRIMARY KEY,
name TEXT
);
CREATE TABLE sales (
sales_id INTEGER,
item_id INTEGER,
num INTEGER,
_____________________
);

A. FOREIGN KEY (id) REFERENCES item_master (item_id)


B. FOREIGN KEY (item_id) REFERENCES item_master (id)
C. REFERENCES item_master (item_id)
D. REFERENCES item_master (id)
E. REFERENCES item_master (id) TO item_id

Answer: B

Question: 55

Page 14 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

You want to delete rows in the "product" table which include the value '2004' in the "name" field.
Select the correct statement to achieve this task.

A. DELETE product WHERE name ~ '2004';


B. DELETE product WHERE contain(name, '2004');
C. DELETE FROM product WHERE name IN '2004';
D. DELETE FROM product WHERE name LIKE '%2004%';
E. DELETE FROM product WHERE name SIMILAR TO '2004';

Answer: D

Question: 56
There is a table "tb1" that has a column "c1" defined as type TEXT. The following SQL is
executed while client "A" is connected.
BEGIN;
LOCK TABLE tb1 IN ACCESS EXCLUSIVE MODE;
SELECT * FROM tb1;
While the above 'SELECT' statement is being executed, client "B" connects to the same database
and executes the following SQL.
Select two correct statements describing the behavior of PostgreSQL.
INSERT INTO tb1 (c1) VALUES ('new line');
Note: the default transaction isolation level is set to "read committed".

A. The process for client "B" is blocked until the current connection for client "A" is finished.
B. The process for client "B" is blocked until the current transaction for client "A" is finished.
C. The process for client "B" will be deleted regardless of the condition of client "A".
D. The process of client "B" will affect the SELECT result of client "A".
E. The process of client "B" will not affect the SELECT result of client "A".

Answer: B, E

Question: 57
The "sample" table consists of the following data.
How many rows are returned by executing the following SQL statement?
SELECT i FROM sample GROUP BY i;

A. 1 row
B. 2 rows
C. 3 rows
D. 4 rows
E. 5 rows

Answer: C

Question: 58
The tables "t1" and "t2" are defined below.
Tables "t1" and "t2" have columns "id" that are of INTEGER type, and columns "name" that are of
TEXT type.
t1
t2
The following SQL command was executed. Select the number of rows in the result.
SELECT * FROM t1 RIGHT OUTER JOIN t2 ON t1.id = t2.id;

A. 2 rows
B. 3 rows

Page 15 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

C. 4 rows
D. 5 rows
E. 6 rows

Answer: B

Question: 59
Select the SQL command that must be executed prior to executing the
EXECUTE command.

A. CREATE FUNCTION
B. PREPARE
C. DECLARE
D. LOAD
E. ALLOCATE

Answer: B

Question: 60
Given the following two table definitions, select one SQL statement which will cause an error.
CREATE TABLE sample1 (id INTEGER, data TEXT);
CREATE TABLE sample2 (id INTEGER);

A. SELECT s1.id FROM sample1 s1;


B. SELECT s1.id FROM sample1 AS s1;
C. SELECT data FROM sample1 AS s1, sample2 AS s2
WHERE s1.id = 1 AND s2.id = 2;
D. SELECT id, data FROM sample1 AS s1, sample2 AS s2
WHERE s1.id = s2.id;
E. SELECT s1.id, s1.data FROM sample1 AS s1, sample2 AS s2
WHERE s1.id = s2.id;

Answer: D

Question: 61
What happens if an SQL statement syntax error occurs while a transaction is running? Select the
correct action from below.

A. The transaction continues.


B. The transaction is aborted and a new transaction is started automatically.
C. The transaction is stopped and you cannot issue any SQL commands other than a command
to end the transaction.
D. The connection is terminated.
E. The "postmaster" process is terminated.

Answer: C

Question: 62
The table "tbl" is defined below such that it could only store non-negative integers in the column
"nn".
Select the keyword that is applicable for the underlined blank.
CREATE _______ natural_number AS DECIMAL CHECK (VALUE >= 0);
CREATE TABLE tbl(nn natural_number);

A. VIEW

Page 16 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

B. SCHEMA
C. RULE
D. TYPE
E. DOMAIN

Answer: E

Question: 63
In the "customer" table, you want to change the "email" values which have an "id" value of 10000
or less, to NULL. Select the correct SQL statement to achieve this task.

A. UPDATE email = NULL FROM customer WHERE id <= 10000;


B. UPDATE customer SET email IS NULL WHERE id < 10001;
C. UPDATE customer SET email = NULL WHERE id <= 10000;
D. DELETE FROM customer.email WHERE id < 10001;
E. UPDATE FROM customer SET email = NULL WHERE id <= 10000;

Answer: C

Question: 64
Select one incorrect description regarding the following SQL statement defining a function.
CREATE OR REPLACE FUNCTION get_file_list(TEXT, BOOLEAN)
RETURNS SETOF TEXT LANGUAGE C STRICT
SECURITY DEFINER AS 'myfuncs.so';

A. This function may be defined in 'myfuncs.so'.


B. This function can return multiple rows.
C. This SQL statement defines a function written in the C language.
D. If this function is called with a NULL parameter, it will return 0 when executed.
E. This function operates with the authority of the user who executed it.

Answer: E

Question: 65
The following SQL defines an INSERT with respect to item_view.
Select the keyword that is applicable in the underlined blank.
CREATE _______ foo AS ON INSERT TO item_view
DO INSTEAD INSERT INTO item_table VALUES (NEW.id, NEW.itemname);

A. RULE
B. VIEW
C. TRIGGER
D. FUNCTION
E. CONSTRAINT

Answer: A

Question: 66
The tables "s1" and "s2" are defined below.
The column "id" for tables "s1" and "s2" is of INTEGER type. The column "enable" for table "s1" is
of
BOOLEAN type, and the column "name" for table "s2" is of TEXT type.

s1:
id | enable

Page 17 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

----+--------
1|t
2|f

s2:
id | name
----+------
1 | post
2 | gre
3 | SQL

The following SQL was executed. Select the correct number of rows in the result.
SELECT * FROM s2 WHERE id IN (SELECT id FROM s1);

A. 1 row
B. 2 rows
C. 3 rows
D. 4 rows
E. 5 rows

Answer: B

Question: 67
A table is defined as below. Select the most suitable description about the foreign key constraint.
CREATE TABLE master (id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE record (id INTEGER REFERENCES master (id), count INTEGER);

A. If any row exists in the "record" table, no change can be made to the "master" table.
B. If the "record" table contains a row with an "id", no change can be made at all to the
corresponding "id" row in the "master" table.
C. If the "record" table contains a row with an "id", the corresponding "id" row in the "master"
table cannot be deleted.
D. The "record" table cannot have duplicate "id"s.
E. These SQL statements are invalid; no constraints are created.

Answer: C

Question: 68
You want to create a cursor that will SELECT the "customer" table. The created cursor must be
able to move in any direction and reference data even after the end of the transaction.
Select one answer containing the correct keyword(s) to fill in the underlined blank below.
DECLARE cursor1 __________ FOR SELECT * FROM customer;

A. CURSOR
B. SCROLL CURSOR WITH HOLD
C. INSENSITIVE CURSOR
D. NO SCROLL CURSOR WITH HOLD
E. CURSOR WITHOUT HOLD

Answer: B

Question: 69
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);

Page 18 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

INSERT INTO log_01 VALUES (1, 'error', CURRENT_TIMESTAMP);


SELECT * FROM log;

A. First 'CREATE TABLE' generates a syntax error.


B. Second 'CREATE TABLE' generates a syntax error.
C. 'INSERT' statement generates an error stating that the number of columns and values do not
match".
D. 'SELECT' statement returns 0 rows, and exits successfully.
E. 'SELECT' statement returns 1 row, and exits successfully.

Answer: E

Question: 70
The "sample" table consists of the data below. The column "x" is of type INTEGER.
How many rows are returned by executing the following SQL statement?
SELECT 6 / x FROM sample
WHERE CASE WHEN x = 0 THEN FALSE ELSE TRUE END;

A. "ERROR division by zero" and no rows are returned.


B. 0 rows with no errors.
C. 1 row
D. 2 rows
E. 3 rows

Answer: D

Question: 71
Select the correct SQL statement to define a new data type.

A. CREATE CLASS
B. CREATE FUNCTION
C. CREATE OPERATOR
D. CREATE DATABASE
E. CREATE TYPE

Answer: E

Question: 72
Select two appropriate statements from below about the following SQL statements:
CREATE FUNCTION myfunc(INTEGER) RETURNS text LANGUAGE plpgsql STRICT AS '
DECLARE
x ALIAS FOR $1;
r text := ''default'';
BEGIN
IF x > 100 THEN
SELECT INTO r data FROM mytable WHERE id = x;
END IF;
RETURN r;
END;';

A. An error is generated unless the plpgsql language is registered in the database beforehand.
B. The execution results of SELECT myfunc(-123) differs based on the content of "mytable".
C. When SELECT myfunc(123) is executed an error occurs.
D. When SELECT myfunc(NULL) is executed an error occurs.
E. When SELECT myfunc (0) is executed the text "default" is returned.

Page 19 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Answer: A, E

Question: 73
The table "t1" is defined by the following SQL statement:
CREATE TABLE t1 (id integer, name varchar(20));
You want to increase the execution speed of the SQL statement below:
SELECT id, name FROM t1 WHERE id < 123 AND upper(name) = 'MAMMOTH';
Select the most suitable SQL statement to create an index.

A. CREATE INDEX t1_idx ON t1 (id, upper(name));


B. CREATE INDEX t1_idx ON t1 USING HASH (id);
C. CREATE INDEX t1_idx ON t1 (name);
D. ALTER TABLE ADD INDEX ON t1 (id, upper(name));
E. ALTER TABLE ADD INDEX ON t1 (id, name);

Answer: A

Question: 74
The tables "t1" and "t2" are defined in the same way (they have the same data types and column
names). You want to select rows in "t1" which are not in "t2".
Select a correct keyword to fill in the blank below.
SELECT * FROM t1 ______ SELECT * FROM t2;

A. EXCEPT
B. UNION
C. NAND
D. INTERSECT
E. INTERSECT ALL

Answer: A

Question: 75
Select two suitable statements about the BSD license from below.

A. If you make changes to the source code, feedback must be sent to the original developers.
B. It is used by open source software.
C. User registration is required.
D. It is defined by Free Software Foundation, Inc. (FSF).
E. Software under the BSD license can be incorporated with any programs provided that the
copyright notice appears in all copies.

Answer: B, E

Question: 76
Which normal form has the constraint that there must be no tables with duplicate column values
in the same row?

A. First normal form


B. Second normal form
C. Third normal form
D. Boyce/Codd normal form
E. Fourth normal form

Answer: A

Page 20 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Question: 77
Select one incorrect statement concerning changes from PostgreSQL version 7.4 to 8.0.

A. SAVEPOINT function was added.


B. Point-In-Time Recovery function was added.
C. The shared buffer control algorithm was improved.
D. Two-phase commit function was added.
E. CSV mode was added to the copy command.

Answer: D

Question: 78
Select one false statement about the benefits of using database management systems from
below.

A. You can separate the data storage method from the application.
B. You can separate the data search method from the application.
C. You can separate the data display method from the application.
D. You can reduce the programming workload of programming for managing data.
E. You can share data more easily on systems consisting of multiple computers.

Answer: C

Question: 79
Select two incorrect statements about the Point-In-Time Recovery (PITR) from below.

A. This is a backup method integrating a physical backup and a transaction log (WAL).
B. It is necessary to stop the database server to perform a backup for the first time.
C. Updated data is continuously saved.
D. A restore can be performed to any arbitrary point in time since the starting point of PITR.
E. A backup can only be performed on a per-database basis.

Answer: B, E

Question: 80
Select one incorrect description about changing the settings of PostgreSQL during operation.

A. The current value of a parameter can be confirmed using the SHOW command.
B. All of the current settings can be displayed using the SHOW ALL command.
C. Changes that can be made using the SET command have higher priority than ones in
postgresql.conf.
D. Values set by a superuser using the SET command are valid for different connections made
later.
E. There are parameters that can not be set using the SET command

Answer: D

Question: 81
Which psql command do you need to execute to display the list of tables in the currently
connected database?

A. SELECT * FROM pg_table_list;


B. SHOW tables;
C. \dT

Page 21 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

D. \dt "database_name"
E. \dt

Answer: E

Question: 82
The following table called 'company' is defined as follows:

id | name
----+------------------
1 | Pgsql,inc.
2 | Postgres Co.,Ltd
3 | SQL Company.

Select the most appropriate psql command for generating a text file company.txt on the client side
with the following content:
1,"Pgsql,inc."
2,"Postgres Co.,Ltd"
3,SQL Company.

A. \copy company TO 'company.txt' WITH ','


B. \copy company TO 'company.txt' WITH DELIMITER AS ','
C. \copy company TO 'company.txt' DELIMITER ','
D. \copy company TO "company.txt"
E. \copy company TO company.txt CSV

Answer: E

Question: 83
Select the most suitable statement regarding PostgreSQL's pg_hba.conf configuration file.

A. You can use any number of authentication types on a single line.


B. You cannot set different authentications per user.
C. You can set different authentications per table.
D. The authentication settings in the file are evaluated from the top line to the bottom line.
E. krb5 authentication can only be used for local connections.

Answer: D

Question: 84
I would like to restore the database cluster from the "db1.dump" backup file.
Select the correct command from below. (Note: "postgres" is the superuser)

A. pg_restore -U postgres -f db1.dump db1


B. pg_dump --restore db1 < db1.dump
C. pg_dump -U postgres --restore db1 < db1.dump
D. psql -U postgres -f db1.dump db1
E. pg_resetxlog -U postgres db1 < db1.dump

Answer: D

Question: 85
Select two incorrect statements concerning the system catalog.

A. It stores the object definition information for tables and columns.

Page 22 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

B. There may be changes to specification by major version upgrades.


C. It is accessible as a table; however, it is output in binary format so it can not be read as is.
D. It stores the internal information of the database management system.
E. It is defined based on the standard SQL specification.

Answer: C, E

Question: 86
What does the following command do? Select the correct description from below.
Note: "text=#" is the command prompt for psql.
test=# ANALYZE foo;

A. Collects statistical information related to the content of the database foo.


B. Collects statistical information related to the content of the table foo.
C. Collects statistical information related to the content of the database test.
D. Outputs statistical information related to the content of the table foo.
E. The command does not generate an error; however, it does not do anything either.

Answer: B

Question: 87
What phenomenon occurs if PostgreSQL is used without performing VACUUM ?
Select two appropriate descriptions from those below.

A. Performance is reduced.
B. It gradually gets to the point where connections are denied.
C. The physical size of the database increases considerably in size.
D. Only SELECT queries will be accepted.
E. An e-mail prompting the administrator to perform VACUUM is sent from PostgreSQL.

Answer: A, C

Question: 88
Select the most appropriate statement about the initdb command.

A. It can not be executed by an OS administrator-level user (root user).


B. It can only be executed by the user who installed PostgreSQL.
C. Unless the environment variable PGDATA is set, it can not be executed.
D. When "auto" is designated as the value for the environment variable PGDATA, a directory is
automatically set up.
E. The directory designated by the environment variable PGDATA must exist.

Answer: A

Question: 89
Select the most suitable statement about the creation of a new database.

A. Only a PostgreSQL superuser is authorized to create a new database.


B. The target directory is specified by the environment variable PGDATA or the -D parameter
when creating a database.
C. Only one database can be used at the same time even if two or more databases are created.
D. Only the OS superuser (root) can create databases.
E. You can set the character encoding when creating a new database.

Answer: E

Page 23 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Question: 90
What does the following command do? Choose two incorrect statements from the selection
below.
Note: $ is the command prompt.
$ pg_restore -U postgres -d database1 database1.dump

A. This command restores the database database1 from the file database1.dump.
B. This command connects to a database as the user 'postgres'.
C. This command can not be executed unless the postmaster is running.
D. This command can not restore large objects.
E. This command must be executed under the condition where the database database1 does
not exist.

Answer: D, E

Question: 91
Select one incorrect statement about the command shown below.
Note: $ is the command prompt.
$ dropuser -U admin foo

A. If there is a database owned by foo, an error will occur.


B. If admin is not the owner of foo, an error will occur.
C. If admin doesn't have the superuser privilege, an error will occur.
D. The user admin is removing the user foo.
E. The same process can be performed using the SQL command "DROP USER".

Answer: B

Question: 92
Select an appropriate command to check the PostgreSQL version in psql.

A. \server_version
B. SELECT version;
C. SELECT version();
D. SHOW version;
E. SHOW server;

Answer: C

Question: 93
I would like to check the privileges on the "items" table in psql. Select the most appropriate
command.

A. \a items
B. \d items
C. \t items
D. \p items
E. \z items

Answer: E

Question: 94
What does the following command do? Choose the most appropriate statement from the
selection below.

Page 24 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Note: $ is the command prompt.


$ pg_dump postgres > pgsql

A. Writes a backup of the database postgres to the file pgsql.


B. Writes a backup of the entire database cluster using user postgres to the file pgsql.
C. Backs up the database postgres and writes an error message to the file pgsql.
D. Writes a backup of the entire database cluster to the file postgres and writes an error
message to the file pgsql.
E. Outputs all of the content of the database postgres to the screen using the user pgsql.

Answer: A

Question: 95
The following are statements related to the postmaster. Select one statement that is incorrect.

A. postmaster is a server process that receives connections from clients.


B. The "pg_ctl start" command boots up postmaster.
C. It is not possible to boot up the postmaster process by directly executing the postmaster
command.
D. One postmaster process controls one database cluster.
E. The "pg_ctl stop" command stops postmaster.

Answer: C

Question: 96
It is possible to backup a database cluster by copying the entire data directory. Select two
suitable descriptions regarding this backup method.

A. The backup data will be a text file consisting of SQL statements.


B. The database server must be stopped prior to the backup.
C. The "pg_restore" command is used to restore the database.
D. "psql" is used to restore the database.
E. You can use standard tools like "tar" and "rsync" to backup files and directories.

Answer: B, E

Question: 97
Select two incorrect statements related to the command below.
Note: $ is the command prompt.
$ psql -U foo -c "COPY company TO stdout;" bar

A. If the company table is not readable, an error occurs.


B. The content of the company table is written into a file called 'stdout'.
C. The content of the company table is output in TAB delimited format.
D. An error occurs unless the user foo has administrator privileges.
E. Connects to the database bar.

Answer: B, D

Question: 98
I want to restore data from a text format backup file foo.dump.
Select an appropriate command.

A. pg_dump -R foo < foo.dump


B. pg_restore -d foo foo.dump

Page 25 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

C. pg_restore -f foo.dump foo


D. psql -f foo.dump foo
E. createdb foo < foo.dump

Answer: D

Question: 99
Select the most suitable statement about PostgreSQL from below.

A. There are PostgreSQL GPL license versions and commercial license versions.
B. You need to be pre-registered to use PostgreSQL.
C. PostgreSQL can be used by everyone free of charge for any purpose, be it private,
commercial, or academic.
D. You can use PostgreSQL for free; however, the source code is not open to the public.
E. PostgreSQL is shareware.

Answer: C

Question: 100
Based on the relationship of columns within a table, select the most suitable description that
shows that column A is dependent on column B.

A. The value in column B is uniquely determined when a value in column A is selected.


B. The value in column A is uniquely determined when a value in column B is selected.
C. When the value in column A is changed, the corresponding value in column B also must be
changed.
D. When the value in column B is changed, the corresponding value of column A also must be
changed.
E. As long as column B exists, the amount of information will not decrease even if column A is
deleted.

Answer: B

Question: 101
The following question concerns the use of multibyte characters in PostgreSQL.
Select two correct items about character encoding in PostgreSQL.

A. "./configure --enable-multibyte" must be designated at time of build.


B. When the database cluster is initialized, the or --multibyte option must be specified.
C. Character encoding can be set on a per database basis.
D. Only a single character encoding can be specified for each database cluster.
E. Different character encodings can be specified for server and clients.

Answer: C, E

Question: 102
From the SQL commands below, select one that is generally classified as "DDL".

A. START TRANSACTION
B. CREATE TABLE
C. SELECT
D. INSERT
E. DELETE

Answer: B

Page 26 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Question: 103
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.

A. An error occurs when executing the (1) SQL statement.


B. An error occurs when executing the (2) SQL statement.
C. An error occurs when executing the (3) SQL statement.
D. An error occurs when executing the (4) SQL statement.
E. No error is generated.

Answer: E

Question: 104
A set of tables are defined as follows:
t1
t2
How many rows are returned by executing the following SQL statement?
SELECT * FROM t1
WHERE EXISTS (SELECT name FROM t2 WHERE t1.id = t2.id);

A. 0 rows
B. 2 rows
C. 3 rows
D. 5 rows
E. 6 rows

Answer: B

Question: 105
SQL statements were executed in the following order.
CREATE TABLE book (
id VARCHAR(21), title TEXT NOT NULL, price INT,
UNIQUE (id), CHECK (price > 0)
);
INSERT INTO book VALUES ('4-12345-678-9', 'SQL book', 2300); --(1)
INSERT INTO book (title, price) VALUES ('PostgreSQL', 3000); --(2)
UPDATE book SET id = '4-12345-678-9' WHERE id IS NULL; --(3)
DELETE FROM book WHERE price < 0; --(4)
While executing, select the first location that generates an error.

A. (1)
B. (2)
C. (3)
D. (4)
E. No error is generated.

Answer: C

Page 27 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Question: 106
Select one incorrect statement concerning the following SQL statement.
CREATE OR REPLACE VIEW sales_view
AS SELECT * FROM sales_table ORDER BY sales_date DESC LIMIT 10;

A. Defines the view called "sales_view".


B. Replaces "sales_view" if it already exists.
C. When you 'SELECT' the "sales_view", it displays the first 10 records from the "sales_table"
sorted by the "sales_date" column in descending order.
D. Some errors occur when "SELECT * FROM sales_table" is executed after the view is defined.
E. You can confirm that the "sales_view" has been added by querying the view called
"pg_views".

Answer: D

Question: 107
A set of tables are defined as follows:
t1
t2
How many rows are returned by executing the following SQL statement?
SELECT * FROM t1 LEFT OUTER JOIN t2 USING (id);

A. 2 rows
B. 3 rows
C. 4 rows
D. 5 rows
E. 6 rows

Answer: C

Question: 108
Table t1 is defined as follows:
CREATE TABLE t1 (value VARCHAR(5));
A set of SQL statements were executed in the following order. Select the number of rows that
table "t1" has after execution.
BEGIN;
INSERT INTO t1 VALUES ('A');
SAVEPOINT sp;
INSERT INTO t1 VALUES ('B');
ROLLBACK TO sp;
INSERT INTO t1 VALUES ('C');
COMMIT;

A. 1 row
B. 2 rows
C. 3 rows
D. 4 rows
E. 0 rows

Answer: B

Question: 109
SQL statements were executed in the following order:
CREATE TABLE fmaster
(id INTEGER PRIMARY KEY, name TEXT);

Page 28 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

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 the two SQL statements that will generate an error when executed next.

A. DROP TABLE ftrans;


B. INSERT INTO fmaster VALUES (1, 'itemB');
C. DELETE FROM fmaster;
D. UPDATE fmaster SET name = NULL;
E. INSERT INTO ftrans VALUES (1, 2, NULL);

Answer: B, C

Question: 110
The table "t1" is defined below.
The column "id" for table "t1" is of INTEGER type.

id | name
----+------------
1 | mammoth
2 | tortoise
3 | coelacanth

The following SQL statements were executed. Select the correct statement about the execution
result.
BEGIN;
DECLARE c SCROLL CURSOR FOR SELECT name FROM t1 ORDER BY id;
MOVE FORWARD 2 FROM c;
FETCH FORWARD ALL FROM c;
COMMIT;

A. The number of rows returned by the FETCH statement is 0.


B. The number of rows returned by the FETCH statement is 1.
C. The number of rows returned by the FETCH statement is 2.
D. The number of rows returned by the FETCH statement is 3.
E. An error occurs part way through.

Answer: B

Question: 111
Select two incorrect statements regarding large objects.

A. A large object is generated by 'CREATE LARGE OBJECT'.


B. A large object is added by 'INSERT'.
C. One large object is able to handle up to 2GB of data.
D. Binary data cannot be used unless declared as a large object.
E. An OID is used to identify a large object.

Answer: C, E

Question: 112
Select two incorrect descriptions regarding the following SQL statements.
CREATE TABLE cities (
name text,

Page 29 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

population float
);
CREATE TABLE capitals (
state char(2)
) INHERITS (cities);

A. Defines the tables called "cities" and "capitals".


B. "capitals" inherits "cities".
C. Searching "capitals" also searches rows in "cities".
D. The columns "name" and "population" are also defined in "capitals".
E. The second SQL statement results in an error, since the 'INHERITS' keyword is no longer
available.

Answer: C, E

Question: 113
Select two SQL statements which abort a transaction.

A. END
B. ROLLBACK
C. TRUNCATE
D. ABORT
E. DROP TRANSTACTION

Answer: B, D

Question: 114
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:


UPDATE custom SET email = '' FROM custom c
WHERE custom.introducer = c.id;
UPDATE custom SET introducer = NULL
WHERE introducer NOT IN (SELECT id FROM custom);
DELETE FROM custom WHERE id = 2 OR introducer = 2;
Select the number of rows in the "custom" table after the execution.

A. 0 rows
B. 1 row
C. 2 rows
D. 3 rows
E. 4 rows

Answer: A

Question: 115
The "sample" table consists of the following data:

Page 30 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

How many rows are returned by executing the following SQL statement?
SELECT i FROM sample GROUP BY i HAVING count(*) = 2;

A. 0 rows
B. 1 row
C. 2 rows
D. 3 rows
E. 4 rows

Answer: C

Question: 116
A table is defined as follows:
CREATE TABLE t (id INT, val TEXT);
Select two correct statements from below about the function "get_head" defined below.
CREATE FUNCTION get_head(BOOLEAN)
RETURNS TEXT LANGUAGE sql CALLED ON NULL INPUT
AS 'SELECT val FROM t WHERE $1 OR id > 0 ORDER BY id LIMIT 1;';

A. This function is defined using PL/pgSQL.


B. There are cases where this function returns multiple lines.
C. When NULL is passed for the argument and the function is executed, NULL is returned.
D. Even if this function is passed the same parameter value and executed multiple times, the
returned values will not necessarily also be the same value.
E. If a function with the same name and with type BOOLEAN as the parameter is already
defined, an error occurs.

Answer: D, E

Question: 117
A set of tables are defined as follows:
t1
t2
How many rows are returned by executing the following SQL statement?
SELECT t1.name FROM t1 CROSS JOIN t2;

A. 0 rows
B. 2 rows
C. 3 rows
D. 5 rows
E. 6 rows

Answer: E

Question: 118
The table "score" is defined as follows:

gid | score
-----+-------
1 | 70
1 | 60
2 | 100
3 | 80
3 | 50

Page 31 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

The following query was executed. Select the correct result value.
SELECT score FROM score ORDER BY gid DESC, score ASC LIMIT 1;

A. 50
B. 60
C. 70
D. 80
E. 100

Answer: A

Question: 119
Given the following two table definitions, select one SQL statement which will cause an error.
CREATE TABLE sample1 (id INTEGER, data TEXT);
CREATE TABLE sample2 (id INTEGER);

A. SELECT s1.id FROM sample1 s1;


B. SELECT s1.id FROM sample1 AS s1;
C. SELECT data FROM sample1 AS s1, sample2 AS s2
WHERE s1.id = 1 AND s2.id = 2;
D. SELECT id, data FROM sample1 AS s1, sample2 AS s2
WHERE s1.id = s2.id;
E. SELECT s1.id, s1.data FROM sample1 AS s1, sample2 AS s2
WHERE s1.id = s2.id;

Answer: D

Question: 120
A set of tables are defined as follows:
t1
t2
How many rows are returned by executing the following SQL statement?
SELECT * FROM t1 UNION ALL SELECT * FROM t2;

A. 2 rows
B. 3 rows
C. 4 rows
D. 5 rows
E. An error will occur.

Answer: D

Question: 121
Select one incorrect statement about schemas.

A. A schema is the name space for a database object.


B. A new schema is created by 'CREATE SCHEMA'.
C. One user cannot own multiple schemas.
D. 'SELECT current_schema();' returns the current schema.
E. 'DROP SCHEMA' deletes a schema.

Answer: C

Question: 122
Select two incorrect statements concerning the BOOLEAN type in PostgreSQL.

Page 32 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

A. BOOLEAN is an alias of the INTEGER type in PostgreSQL.


B. BOOLEAN only takes either NULL, TRUE, or FALSE.
C. You can use the characters 't' or 'f' as a value for the BOOLEAN type.
D. You can use the TRUE or FALSE keywords as a value for the BOOLEAN type.
E. If the INTEGER value of '0' is inserted into a BOOLEAN column, it will be treated as FALSE.

Answer: A, E

Question: 123
Select an incorrect statement regarding prepared statements, and 'PREPARE' / 'EXECUTE'
commands.

A. 'PREPARE'/'EXECUTE' is mainly used to optimize performance.


B. 'PREPARE' creates a plan for the prepared statement.
C. 'PREPARE' can only specify 'SELECT' as a prepared statement.
D. 'EXECUTE' executes the plan defined by 'PREPARE'.
E. 'DEALLOCATE' deallocates prepared statements.

Answer: C

Question: 124
Select one statement which will cause a syntax error.

A. SELECT (SELECT item FROM sale WHERE id = 1);


B. SELECT * FROM (SELECT * FROM customer);
C. SELECT * FROM item
WHERE cid IN (SELECT cid FROM customer);
D. SELECT * FROM sale
WHERE name IN (SELECT name FROM names);
E. SELECT * FROM sale
WHERE cid = ANY (SELECT cid FROM customer);

Answer: B

Question: 125
Select two incorrect statements regarding 'TRIGGER'.

A. When UPDATE is executed to the table, the specified function can be called.
B. When INSERT is executed to the table, the specified function can be called.
C. When SELECT is executed to the table, the specified function can be called.
D. A trigger can be set up to call a specified function before or after the event occurs.
E. A corresponding rule is automatically created when a trigger is created.

Answer: C, E

Question: 126
The following table called company is defined as follows:

id | name
----+------------------
1 | Pgsql,inc.
2 | Postgres Co.,Ltd
3 | SQL Company.

Page 33 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Select the most appropriate psql command for generating a text file company.txt with the
following content on the client side.
1,Pgsql \,inc.
2,Postgres Co. \,Ltd
3,SQL Company.

A. \copy company TO 'company.txt' WITH ',';


B. \copy company TO 'company.txt' WITH DELIMITER AS ',';
C. \copy company TO 'company.txt' DELIMITER ','
D. \copy company TO "company.txt"
E. \copy company TO company.txt CSV

Answer: C

Question: 127
What does the following command do? Choose one incorrect statement from the selection below.
$ pg_dumpall -U postgres > 20060601.bak

A. Backup all the databases in a database cluster.


B. Backup postgresql.conf along with databases.
C. Backup with plain-text format.
D. Backup user and group information along with databases.
E. You can access databases while the backup is in process.

Answer: B

Question: 128
Select one incorrect statement about the SQL COPY command.

A. It copies data between a file and a table.


B. You can output the row data of a table to a specified client side file.
C. Copies row data from a file into a table.
D. Only the superuser can specify the output file name.
E. The delimiter that separates column data can be changed from the default TAB character.

Answer: B

Question: 129
Select two incorrect statements about the function of the information schema.

A. It consists of a group of views included in a schema called "information_schema".


B. Information on objects defined in a database can be referenced.
C. The number of tables defined in a database can be confirmed.
D. Administrator privileges are needed to reference the information schema.
E. In order to enable the information schema, "information_schema = true" must be set in
postgresql.conf

Answer: D, E

Question: 130
I would like to be able to save log entries as shown below. Select a correct configuration setting
from statements below.
LOG: connection received: host=[local] port=
LOG: connection authorized: user=postgres database=test

Page 34 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

A. syslog = true
B. log_connections = true
C. log_authorization = true
D. log_hostname = true
E. log_min_level = log

Answer: B

Question: 131
Select two suitable statements about postgresql.conf configuration.

A. A line that starts with ! (exclamation mark) is interpreted as a comment.


B. You can have different parameters for the same option to configure each database
differently.
C. The timing of when a change in any value is reflected is different depending on the
configuration parameter.
D. All options have no default values. Therefore, all of them must be set specifically and
thoroughly.
E. As a boolean value, any of the following can be used: TRUE, FALSE, ON, OFF, YES, NO, 1,
0.

Answer: C, E

Question: 132
Select two commands below from which privileges cannot be changed by the GRANT and
REVOKE statements.

A. SELECT
B. VACUUM
C. DELETE
D. TRIGGER
E. DROP

Answer: B, E

Question: 133
Select two correct statements about the command shown below.
Note: $ is the command prompt.
$ vacuumdb -az

A. Recovers unused areas from all of the databases.


B. Collects statistical information related to the table content for all of the databases.
C. Processes the job equivalent of the VACUUM FULL command for all of the databases.
D. Processes the job equivalent of the VACUUM VERBOSE command for all of the databases.
E. The database can not be accessed until this command is finished.

Answer: A, B

Question: 134
Select two commands used to check the syntax of the ALTER TABLE statement in psql.

A. \h ALTER TABLE
B. \h ALTER
C. \ ALTER TABLE
D. \ ALTER

Page 35 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

E. HELP ALTER TABLE;

Answer: A, B

Question: 135
Select one incorrect statement from the below about a database cluster.

A. It is possible to have multiple databases within a database cluster.


B. A database cluster is created using initdb command.
C. Each host can have only one database cluster.
D. Special databases called template0 and template1 are created in a database cluster by
default.
E. When a database cluster is created, a database superuser is registered using the username of
the OS at the time of creation unless otherwise designated.

Answer: C

Question: 136
Select one SQL statement that will cause an error.

A. SELECT version;
B. SELECT current_user;
C. SELECT current_date;
D. SELECT current_timestamp;
E. SELECT current_database();

Answer: A

Question: 137
Select two statements that the command below DOES NOT do.
Note: $ is the command prompt.
$ pg_dump -b -F c b > d

A. Backs up the "b" database to the "c" file, and stores error messages to the "d" file.
B. Backs up the "b" database to the "d" file.
C. Backs up large objects.
D. Backs up the "c" database to the "d" file as the "c" user.
E. Creates a backup, which is restorable with the pg_restore command.

Answer: A, D

Question: 138
A pg_hba.conf file is set up as follows.
local all all md5
host all all 127.0.0.1/32 md5
host all all 172.16.1.0/24 md5
When user foo connects to database bar from host IP address 172.16.1.2, I would like password
verification to not be performed.
Select one appropriate line for the new pg_hba.conf file.

A. Add "host foo bar 172.16.1.2/32 trust" to the first row.


B. Add "host bar foo 172.16.1.2/32 trust" to the first row.
C. Add "host foo bar 172.16.1.2/32 trust" to the last row.
D. Add "host bar foo 172.16.1.2/32 trust" to the last row.
E. The settings are fine as is.

Page 36 of 37
Exam Name: PostgreSQL CE 8 Silver
Exam Type: PostgreSQL CE
Exam Code: PGCES-02 Total Questions: 142

Answer: B

Question: 139
Select two suitable statements regarding a postmaster process.

A. A postmaster process waits for client connection requests.


B. A postmaster process receives and processes database queries.
C. A postmaster process creates a child process which processes the given queries.
D. A postmaster process collects statistical information.
E. A postmaster process is created for each client connection.

Answer: A, C

Question: 140
Select a correct SQL command to change existing user "george"'s password to "foobar".

A. ALTER USER george WITH PASSWORD 'foobar';


B. ALTER USER george CHANGE PASSWORD 'foobar';
C. ALTER USER george SET PASSWORD 'foobar';
D. SET USER george PASSWORD TO 'foobar';
E. SET USER george ALTER PASSWORD 'foobar';

Answer: A

Question: 141
psql generated the following error message:
psql: could not connect to server: Connection was refused
Is the server running on host "server.example.com" and accepting
TCP/IP connections on port 5432?
Select two reasons that are NOT the cause of this error.

A. Host "server.example.com" does not exist.


B. The PostgreSQL server is not running on "server.example.com".
C. The PostgreSQL server is not accepting TCP/IP connections on "server.example.com".
D. The PostgreSQL server is running on a port other than 5432 on "server.example.com".
E. The username and/or password are incorrect.

Answer: A, E

Question: 142
Select two correct statements from below concerning the ANALYZE command.

A. It renews the statistical information of the table content.


B. It takes some time to execute, but it does not lock the table.
C. If the FULL option is used when executing, the size of the file can be reduced.
D. If ANALYZE is insufficient, the most efficient search plan will not be selected for queries.
E. If ANALYZE is not used at all, there are times when it becomes impossible to see any of the
data.

Answer: A, D

End of the Document

Page 37 of 37

Вам также может понравиться