pstgresql dump

Upload: nj-singh

Post on 14-Apr-2018

242 views

Category:

Documents


2 download

TRANSCRIPT

  • 7/29/2019 PstgreSQL Dump

    1/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 1 of 37

    Question: 1Select two suitable statements regarding the following SQL statement:CREATE TRIGGER trigger_1 AFTER UPDATE ON sales FOR EACH ROWEXECUTE 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: 2Select two transaction isolation levels supported in PostgreSQL.

    A. DIRTY READB. READ COMMITTEDC. REPEATABLE READ

    D. PHANTOM READE. SERIALIZABLE

    Answer: B, E

    Question: 3PostgreSQL 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: 4Select 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: 5Select 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.

  • 7/29/2019 PstgreSQL Dump

    2/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 2 of 37

    Answer: A, D

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

    gid | score-----+-------1 | 701 | 602 | 1003 | 803 | 50

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

    A. 1 row

    B. 2 rowsC. 3 rowsD. 4 rowsE. 5 rows

    Answer: C

    Question: 7Table "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 thattable "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 rowB. 2 rowsC. 3 rowsD. 4 rows

    E. 0 rows

    Answer: B

    Question: 8Select two suitable statements about sequences.

    A. A sequence always returns a 4-byte INTEGER type value, so the maximum value is2147483647.

    B. A sequence is defined by 'CREATE SEQUENCE', and deleted by 'DROP SEQUENCE'.

  • 7/29/2019 PstgreSQL Dump

    3/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 3 of 37

    C. Although the "nextval" function is called during a transaction, it will have no effect if thattransaction 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: 9The "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 rowsB. 3 rowsC. 4 rows D. 5 rowsE. 6 rows

    Answer: B

    Question: 10The 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 "Asynchronousnotification '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 thisconnection.

    Answer: B

    Question: 11Select 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: 12Select two correct descriptions about views.

  • 7/29/2019 PstgreSQL Dump

    4/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 4 of 37

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

    B. The update process for client "B" is blocked until the current transaction for client "A" isfinished.

    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: 14SQL 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: 15Select three SQL statements which return NULL.

    A. SELECT 0 =NULL;

  • 7/29/2019 PstgreSQL Dump

    5/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 5 of 37

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

    Answer: A, B, D

    Question: 16The table "custom" is defined below.The "id" column and "introducer" column are of INTEGER type, and the "email" column is ofTEXT type.

    id | email | introducer----+-----------------+------------2 | [email protected] | 13 | [email protected] | 24 | [email protected] | 2

    Three SQL statements were executed in the following order:

    INSERT INTO customSELECT max(id) +1, '[email protected]', 4 FROM custom;UPDATE custom SET introducer =999WHERE email ='[email protected]';DELETE FROM customWHERE introducer NOT IN (SELECT id FROM custom);Select the number of rows in the "custom" table after the execution.

    A. 0 rowsB. 1 rowC. 2 rowsD. 3 rowsE. 4 rows

    Answer: C

    Question: 17The "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 rowsB. 1 rowC. 2 rowsD. 3 rowsE. 4 rows

    Answer: C

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

    A. It is defining a rule "rule_1".

  • 7/29/2019 PstgreSQL Dump

    6/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 6 of 37

    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: 19The "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: 20Four 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: 21A table named "sample" is defined as below. Select two statements which will generate aconstraint error.CREATE TABLE sample (i INTEGER PRIMARY KEY,j INTEGER,CHECK ( i >0 AND j

  • 7/29/2019 PstgreSQL Dump

    7/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 7 of 37

    ---------+----------plpgsql | yesSelect 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: 23Given 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: 24Select 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: 25The tables "t1" and "t2" are defined below.The tables "t1" and "t2" have columns "id" which are type of INTEGER and column "name"swhich are type of TEXT.t1t2The following SQL command was executed. Select the number of rows in the result.SELECT * FROM t1 NATURAL FULL OUTER J OIN t2;

    A. 2 rowsB. 3 rowsC. 4 rowsD. 5 rowsE. 6 rows

    Answer: D

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

  • 7/29/2019 PstgreSQL Dump

    8/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 8 of 37

    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: 27Select 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: 28Select 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: 29Select 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: 30Select 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

  • 7/29/2019 PstgreSQL Dump

    9/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 9 of 37

    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: 32I 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: 33Select 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: 34What does the following command do? Select two correct descriptions regarding this SQLstatement.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: 35Select two correct statements that describe what occurs on the client side when the followingcommand is executed.pg_ctl -m smart stop

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

  • 7/29/2019 PstgreSQL Dump

    10/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 10 of 37

    B. The running transaction for a connected client is rolled back and the connection isdisconnected 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: 36Select 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 serverprocess.

    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: 37I 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 =UNICODEB. frontend_encoding =UNICODEC. client_encoding =UNICODE

    D. default_encoding =UTF8E. encoding =UTF8

    Answer: C

    Question: 38Select 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: 39I 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.

  • 7/29/2019 PstgreSQL Dump

    11/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 11 of 37

    B. When using the Tablespace function, it is necessary to back up the directory that stores thetablespace as well.

    C. A database cluster that has been restored can be used on a separate machine with the samestructure.

    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: 40Select the correct command to collect and save the statistical information of a table.

    A. ANALYZEB. CLUSTERC. REINDEXD. STATISTIC COLLECTIONE. STATISTIC COLLECTOR

    Answer: A

    Question: 41Choose 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 PostgreSQLusers.

    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: 42I 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: 43Configuration file pg_hda.conf is set as below on a host currently runningPostgreSQL.local all all trusthost all all 192.168.1.0/24 rejecthost all all 192.168.0.0/16 trustSelect a host IP address which is authorized to connect to this database via the network.Note: INET domain socket communication is available.

  • 7/29/2019 PstgreSQL Dump

    12/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 12 of 37

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

    Answer: C

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

    A. pg_ctl stopB. pg_ctl -m fast stopC. pg_ctl -m immediate stopD. pg_ctl -m wait stopE. pg_ctl -s stop

    Answer: A

    Question: 45Select 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 localeB. Character encodingC. Host nameD. Database ownerE. Template database

    Answer: A

    Question: 47You have just added an option "listen_addresses ='localhost'" inpostgresql.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

  • 7/29/2019 PstgreSQL Dump

    13/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 13 of 37

    Question: 48Select 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: 49Based on the following request, select the most appropriate command for creating a databasecluster.?Character encoding of the template database needs to be EUC_J P?Locale is not used

    A. initdb --locale=EUC_J P --no-encodingB. initdb --default-encoding=EUC_J P

    C. pg_ctl init --locale=EUC_J PD. initdb --encoding=EUC_J P --no-localeE. pg_ctl init --encoding=EUC_J P

    Answer: D

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

    A. VACUUMB. VACUUM ANALYZEC. EXPLAIN

    D. EXPLAIN ANALYZEE. NOTIFY

    Answer: B

    Question: 51A 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. 0B. 1

    C. 10D. 11E. -10

    Answer: B

    Question: 52A 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;

  • 7/29/2019 PstgreSQL Dump

    14/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 14 of 37

    A set of SQL statements were executed in the order below. Select the most appropriatestatement 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: 53The present time is noon of J uly 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'::timestampB. '10 day'::intervalC. 10::dayD. 8640000::timeE. 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 thatalready exists as "id" in the "item_master" table. Select the correct SQL statement to fill in theunderlined 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

  • 7/29/2019 PstgreSQL Dump

    15/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 15 of 37

    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: 56There is a table "tb1" that has a column "c1" defined as type TEXT. The following SQL isexecuted 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 databaseand 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 rowB. 2 rowsC. 3 rowsD. 4 rowsE. 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 ofTEXT type.t1t2The following SQL command was executed. Select the number of rows in the result.SELECT * FROM t1 RIGHT OUTER J OIN t2 ON t1.id =t2.id;

    A. 2 rowsB. 3 rows

  • 7/29/2019 PstgreSQL Dump

    16/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 16 of 37

    C. 4 rowsD. 5 rowsE. 6 rows

    Answer: B

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

    A. CREATE FUNCTIONB. PREPAREC. DECLARED. LOADE. 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: 61What happens if an SQL statement syntax error occurs while a transaction is running? Select thecorrect 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: 62The 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

  • 7/29/2019 PstgreSQL Dump

    17/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 17 of 37

    B. SCHEMAC. RULED. TYPEE. DOMAIN

    Answer: E

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

    A. UPDATE email =NULL FROM customer WHERE id

  • 7/29/2019 PstgreSQL Dump

    18/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 18 of 37

    ----+--------1 | t2 | f

    s2:

    id | name----+------1 | post2 | gre3 | 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 rowB. 2 rowsC. 3 rowsD. 4 rowsE. 5 rows

    Answer: B

    Question: 67A 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: 68You want to create a cursor that will SELECT the "customer" table. The created cursor must beable 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. CURSORB. SCROLL CURSOR WITH HOLD

    C. INSENSITIVE CURSORD. NO SCROLL CURSOR WITH HOLDE. CURSOR WITHOUT HOLD

    Answer: B

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

  • 7/29/2019 PstgreSQL Dump

    19/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 19 of 37

    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 notmatch".D. 'SELECT' statement returns 0 rows, and exits successfully.E. 'SELECT' statement returns 1 row, and exits successfully.

    Answer: E

    Question: 70The "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 sampleWHERE 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 rowD. 2 rowsE. 3 rows

    Answer: D

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

    A. CREATE CLASSB. CREATE FUNCTIONC. CREATE OPERATOR

    D. CREATE DATABASEE. CREATE TYPE

    Answer: E

    Question: 72Select two appropriate statements from below about the following SQL statements:CREATE FUNCTION myfunc(INTEGER) RETURNS text LANGUAGE plpgsql STRICT AS 'DECLAREx ALIAS FOR $1;r text :=''default'';BEGINIF 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.

  • 7/29/2019 PstgreSQL Dump

    20/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 20 of 37

    Answer: A, E

    Question: 73The 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

  • 7/29/2019 PstgreSQL Dump

    21/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 21 of 37

    Question: 77Select 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: 78Select one false statement about the benefits of using database management systems frombelow.

    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: 79Select 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: 80Select 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: 81Which psql command do you need to execute to display the list of tables in the currentlyconnected database?

    A. SELECT * FROM pg_table_list;B. SHOW tables;C. \dT

  • 7/29/2019 PstgreSQL Dump

    22/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 22 of 37

    D. \dt "database_name"E. \dt

    Answer: E

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

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

    Select the most appropriate psql command for generating a text file company.txt on the client sidewith 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: 83Select 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: 84I 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 db1B. pg_dump --restore db1

  • 7/29/2019 PstgreSQL Dump

    23/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 23 of 37

    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: 86What 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: 87What 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: 88Select 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

  • 7/29/2019 PstgreSQL Dump

    24/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 24 of 37

    Question: 90What does the following command do? Choose two incorrect statements from the selectionbelow.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: 91Select 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: 92Select an appropriate command to check the PostgreSQL version in psql.

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

    Answer: C

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

    A. \a items

    B. \d itemsC. \t itemsD. \p itemsE. \z items

    Answer: E

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

  • 7/29/2019 PstgreSQL Dump

    25/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 25 of 37

    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 errormessage to the file pgsql.

    E. Outputs all of the content of the database postgres to the screen using the user pgsql.

    Answer: A

    Question: 95The 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: 96It is possible to backup a database cluster by copying the entire data directory. Select twosuitable 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: 97Select 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: 98I want to restore data from a text format backup file foo.dump.Select an appropriate command.

    A. pg_dump -R foo

  • 7/29/2019 PstgreSQL Dump

    26/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 26 of 37

    C. pg_restore -f foo.dump fooD. psql -f foo.dump fooE. createdb foo

  • 7/29/2019 PstgreSQL Dump

    27/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 27 of 37

    Question: 103The 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: 104A set of tables are defined as follows:t1t2How many rows are returned by executing the following SQL statement?SELECT * FROM t1WHERE EXISTS (SELECT name FROM t2 WHERE t1.id =t2.id);

    A. 0 rowsB. 2 rowsC. 3 rowsD. 5 rowsE. 6 rows

    Answer: B

    Question: 105SQL 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

  • 7/29/2019 PstgreSQL Dump

    28/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 28 of 37

    Question: 106Select one incorrect statement concerning the following SQL statement.CREATE OR REPLACE VIEW sales_viewAS 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: 107A set of tables are defined as follows:t1t2

    How many rows are returned by executing the following SQL statement?SELECT * FROM t1 LEFT OUTER J OIN t2 USING (id);

    A. 2 rowsB. 3 rowsC. 4 rowsD. 5 rowsE. 6 rows

    Answer: C

    Question: 108Table 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 thattable "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 rowB. 2 rows

    C. 3 rowsD. 4 rowsE. 0 rows

    Answer: B

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

  • 7/29/2019 PstgreSQL Dump

    29/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 29 of 37

    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: 110The table "t1" is defined below.The column "id" for table "t1" is of INTEGER type.

    id | name

    ----+------------1 | mammoth2 | tortoise3 | coelacanth

    The following SQL statements were executed. Select the correct statement about the executionresult.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: 111Select two incorrect statements regarding large objects.

    A. A large object is generated by 'CREATE LARGE OBJ ECT'.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: 112Select two incorrect descriptions regarding the following SQL statements.CREATE TABLE cities (name text,

  • 7/29/2019 PstgreSQL Dump

    30/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 30 of 37

    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: 113Select two SQL statements which abort a transaction.

    A. END

    B. ROLLBACKC. TRUNCATED. ABORTE. DROP TRANSTACTION

    Answer: B, D

    Question: 114The table "custom" is defined below.The "id" column and "introducer" column are of INTEGER type, and the "email" column is ofTEXT type.

    id | email | introducer

    ----+-----------------+------------2 | [email protected] | 13 | [email protected] | 24 | [email protected] | 2

    Three SQL statements were executed in the following order:UPDATE custom SET email ='' FROM custom cWHERE custom.introducer =c.id;UPDATE custom SET introducer =NULLWHERE 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 rowsB. 1 rowC. 2 rowsD. 3 rowsE. 4 rows

    Answer: A

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

  • 7/29/2019 PstgreSQL Dump

    31/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 31 of 37

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

    A. 0 rowsB. 1 row

    C. 2 rowsD. 3 rowsE. 4 rows

    Answer: C

    Question: 116A 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 INPUTAS '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: 117A set of tables are defined as follows:t1

    t2How many rows are returned by executing the following SQL statement?SELECT t1.name FROM t1 CROSS J OIN t2;

    A. 0 rowsB. 2 rowsC. 3 rowsD. 5 rowsE. 6 rows

    Answer: E

    Question: 118

    The table "score" is defined as follows:

    gid | score-----+-------1 | 701 | 602 | 1003 | 803 | 50

  • 7/29/2019 PstgreSQL Dump

    32/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 32 of 37

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

    A. 50B. 60

    C. 70D. 80E. 100

    Answer: A

    Question: 119Given 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: 120A set of tables are defined as follows:t1t2How many rows are returned by executing the following SQL statement?

    SELECT * FROM t1 UNION ALL SELECT * FROM t2;

    A. 2 rowsB. 3 rowsC. 4 rowsD. 5 rowsE. An error will occur.

    Answer: D

    Question: 121Select 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: 122Select two incorrect statements concerning the BOOLEAN type in PostgreSQL.

  • 7/29/2019 PstgreSQL Dump

    33/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 33 of 37

    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: 123Select 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: 124Select 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: 125Select 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: 126The following table called company is defined as follows:

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

  • 7/29/2019 PstgreSQL Dump

    34/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 34 of 37

    Select the most appropriate psql command for generating a text file company.txt with thefollowing content on the client side.1,Pgsql \,inc.2,Postgres Co. \,Ltd3,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: 127What 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: 128Select 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: 129Select 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: 130I would like to be able to save log entries as shown below. Select a correct configuration settingfrom statements below.LOG: connection received: host=[local] port=LOG: connection authorized: user=postgres database=test

  • 7/29/2019 PstgreSQL Dump

    35/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 35 of 37

    A. syslog =trueB. log_connections =trueC. log_authorization =trueD. log_hostname =trueE. log_min_level =log

    Answer: B

    Question: 131Select 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: 132Select two commands below from which privileges cannot be changed by the GRANT andREVOKE statements.

    A. SELECTB. VACUUMC. DELETED. TRIGGERE. DROP

    Answer: B, E

    Question: 133Select 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: 134Select two commands used to check the syntax of the ALTER TABLE statement in psql.

    A. \h ALTER TABLEB. \h ALTERC. \ ALTER TABLED. \ ALTER

  • 7/29/2019 PstgreSQL Dump

    36/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Page 36 of 37

    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 bydefault.E. When a database cluster is created, a database superuser is registered using the username ofthe OS at the time of creation unless otherwise designated.

    Answer: C

    Question: 136Select 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: 137Select 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: 138A pg_hba.conf file is set up as follows.local all all md5host all all 127.0.0.1/32 md5

    host all all 172.16.1.0/24 md5When user foo connects to database bar from host IP address 172.16.1.2, I would like passwordverification 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.

  • 7/29/2019 PstgreSQL Dump

    37/37

    Exam Name: PostgreSQL CE 8 Silver

    Exam Type: PostgreSQL CE

    Exam Code: PGCES-02 Total Questions: 142

    Answer: B

    Question: 139Select 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: 140Select 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: 141psql generated the following error message:psql: could not connect to server: Connection was refusedIs the server running on host "server.example.com" and acceptingTCP/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: 142Select 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