Professional Documents
Culture Documents
Pgces 02
Pgces 02
Pgces 02
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
Select the number of rows in the "custom" table after the execution.
Options are :
4 rows
3 rows
2 rows
0 rows
1 row
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)
Options are :
No error is generated
(3)
(4)
(2)
(1)
Answer : (3)
Given the following two table definitions, select one SQL statement which will cause an error.
Options are :
SELECT data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = 1 AND s2.id = 2;
SELECT id, data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
SELECT s1.id, s1.data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
Answer : SELECT id, data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
id | name
----+------------
1 | mammoth
2 | tortoise
3 | coelacanth
The following SQL statements were executed. Select the correct statement about the execution
result.
BEGIN;
COMMIT;
Options are :
Next, four SQL statements were executed in the following order. INSERT INTO foo VALUES
Options are :
No error is generated
t1
t2
How many rows are returned by executing the following SQL statement?
SELECT * FROM t1
Options are :
5rows
0 rows
2rows
4rows
3rows
Answer : 2rows
t1
t2
How many rows are returned by executing the following SQL statement?
Options are :
3rows
2 rows
5rows
4ows
6rows
Answer : 4ows
SQL statements were executed in the following order: CREATE TABLE fmaster
(id INTEGER REFERENCES fmaster (id), stat INTEGER, date DATE); INSERT INTO fmaster
Select the two SQL statements that will generate an error when executed next.
Options are :
a,b
d,e
c,d
b,c
Answer : b,c
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.
Options are :
b,c
c,e
a,b
Answer : c,e
gid | score
-----+-------
1 | 70
1 | 60
2 | 100
3 | 80
3 | 50
The following query was executed. Select the correct result value.
SELECT score FROM score ORDER BY gid DESC, score ASC LIMIT 1;
Options are :
60
80
100
70
50
Answer : 50
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 with the following
1,Pgsql \,inc.
3,SQL Company
Options are :
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
Options are :
a,e
b,c
c,d
a,b
Answer : a,e
Options are :
SELECT * FROM sale WHERE cid = ANY (SELECT cid FROM customer);
From the SQL commands below, select one that is generally classified as "DDL".
Options are :
INSERT
START TRANSACTION
SELECT
CREATE TABLE
DELETE
Options are :
Select one incorrect statement concerning the following SQL statement. CREATE OR REPLACE
VIEW sales_view
Options are :
You can confirm that the "sales_view" has been added by querying the view called "pg_views".
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
Some errors occur when "SELECT * FROM sales_table" is executed after the view is defined
Answer : Some errors occur when "SELECT * FROM sales_table" is executed after the view is defined
t1
t2
How many rows are returned by executing the following SQL statement?
Options are :
2 rows
4 rows
3 rows
5 rows
Select two correct statements from below about the function "get_head" defined below. CREATE
FUNCTION get_head(BOOLEAN)
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
E. If a function with the same name and with type BOOLEAN as the parameter is already
Options are :
a,e
a,b
d,e
c,d
Answer : d,e
Select two incorrect descriptions regarding the following SQL statements. CREATE TABLE cities (
name text,
population float );
state char(2)
) INHERITS (cities);
E. The second SQL statement results in an error, since the 'INHERITS' keyword is no longer
available.
Options are :
a,b
d,e
c,e
c,d
Answer : c,e
commands.
Options are :
'PREPARE' can only specify 'SELECT' as a prepared statement.
A set of SQL statements were executed in the following order. Select the number of rows that
BEGIN;
SAVEPOINT sp;
ROLLBACK TO sp;
COMMIT;
Options are :
4row
5row
3row
0row
1 row
Answer : 3row
The "sample" table consists of the following data:
How many rows are returned by executing the following SQL statement? SELECT i FROM sample
Options are :
0 rows
2 rows
1 row
4 rows
3 rows
Select two correct statements about the command shown below. Note: $ is the command prompt.
$ vacuumdb -az
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.
Options are :
a,b
b,c
d,e
c,d
Answer : a,b
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.
Options are :
c,e
a,b
d,e
c,d
Answer : c,e
I would like to be able to save log entries as shown below. Select a correct configuration setting
Options are :
syslog = true
log_min_level = log
log_hostname = true
log_connections = true
log_authorization = true
Answer : log_connections = true
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
Options are :
d,e
c,d
a,b
b,c
Answer : a,b
When user foo connects to database bar from host IP address 172.16.1.2, I would like password
Options are :
Answer : Add "host bar foo 172.16.1.2/32 trust" to the first row.
Select two statements that the command below DOES NOT do.
$ 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.
D. Backs up the "c" database to the "d" file as the "c" user.
Options are :
c,d
a,d
a,b
b,c
Answer : a,d
Set-2
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.
D. A restore can be performed to any arbitrary point in time since the starting point of PITR.
Options are :
a,b
b,e
d,e
c,d
Answer : b,e
What does the following command do? Select the correct description from below. Note: "text=#" is
Options are :
The command does not generate an error; however, it does not do anything either.
Answer : Collects statistical information related to the content of the table foo
It is possible to backup a database cluster by copying the entire data directory. Select two
E. You can use standard tools like "tar" and "rsync" to backup files and directories.
Options are :
d,e
b,e
a,b
b,c
c,d
Answer : b,e
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
1,"Pgsql,inc."
2,"Postgres Co.,Ltd"
3,SQL Company.
Options are :
None
Options are :
PostgreSQL is shareware.
There are PostgreSQL GPL license versions and commercial license versions
You can use PostgreSQL for free; however, the source code is not open to the public
PostgreSQL can be used by everyone free of charge for any purpose, be it private, commercial, or
academic
Answer : PostgreSQL can be used by everyone free of charge for any purpose, be it private, commercial, or
academic
Which psql command do you need to execute to display the list of tables in the currently
connected database?
Options are :
\dt "database_name"
\dT
\dt
SHOW tables;
Answer : \dt
Select one incorrect description about changing the settings of PostgreSQL during operation.
Options are :
There are parameters that can not be set using the SET command
Values set by a superuser using the SET command are valid for different connections made later.
All of the current settings can be displayed using the SHOW ALL command.
The current value of a parameter can be confirmed using the SHOW command.
Changes that can be made using the SET command have higher priority than ones in postgresql.conf.
Answer : Values set by a superuser using the SET command are valid for different connections made later.
Select the most suitable statement regarding PostgreSQL's pg_hba.conf configuration file.
Options are :
The authentication settings in the file are evaluated from the top line to the bottom line
Answer : The authentication settings in the file are evaluated from the top line to the bottom line
Table "t1" has a column "id" of type INTEGER, and a column "name" of type TEXT.
t1:
While the second 'SELECT' statement, shown with (*), is being executed, a separate client "B"
Options are :
The update process for client "B" is blocked until the current connection for client "A" is finished.
The processes for both clients are blocked, and an error stating that a deadlock has been detected is
generated.
The update process for client "B" is blocked until the current transaction for client "A" is finished.
The 'UPDATE' process for client "B" proceeds regardless of the condition of client "A".
Answer : The update process for client "B" is blocked until the current transaction for client "A" is finished.
Select the correct SQL statement which concatenates strings 'ABC' and 'abc' to form 'ABCabc
Options are :
A table named "sample" is defined as below. Select two statements which will generate a
constraint error.
j INTEGER,
);
Options are :
b,c
d,e
a,b
a,d
Answer : a,d
How many rows are returned by executing the following SQL statement? SELECT DISTINCT ON
Options are :
4 rows D. 5 rows
6 rows
2 rows
3 rows
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 the number of rows in the "custom" table after the execution.
Options are :
2 rows
0 rows
4 rows
3 rows
1 row
Given the following two table definitions, select one SQL statement which will cause an error.
Options are :
Select two SQL statements that will generate an error when executed next.
Options are :
b,c
c,d
a,b
d,e
a,c
Answer : a,c
LISTEN sign_v;
BEGIN;
NOTIFY sign_v;
COMMIT;
LISTEN sign_v;
Options are :
At the point that 'SELECT * FROM pg_user;" is executed, a message that starts with "Asynchronous
notification 'sign_v' received" is output.
The message "Asynchronous notification 'sign_v' received" is not received while in this connection.
When 'LISTEN sign_v' is executed for the second time, a message that starts with "Asynchronous
notification 'sign_v' received" is output.
At the point that 'NOTIFY sign_v' is executed, a message that starts with "Asynchronous notification
'sign_v' received" is output
At the point that 'COMMIT' is executed, a message that starts with "Asynchronous notification 'sign_v'
received" is output
Answer : At the point that 'COMMIT' is executed, a message that starts with "Asynchronous notification
'sign_v' received" is output
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.
Options are :
b,c
d,e
b,d
a,b
Answer : b,c
Four SQL statements were executed in the following order. CREATE TABLE foo (bar INT);
ALTER TABLE foo ALTER bar TYPE BIGINT;
Options are :
c,d
a,b
d,e
b,c
Answer : a,b
A. A sequence always returns a 4-byte INTEGER type value, so the maximum value is
2147483647.
C. Although the "nextval" function is called during a transaction, it will have no effect if that
Options are :
c,d
d,e
b,e
a,b
Answer : b,e
A set of SQL statements were executed in the following order. Select the number of rows that
BEGIN;
SAVEPOINT point1;
SAVEPOINT point2;
ROLLBACK TO point1;
Options are :
2 rows
1 row
0 rows
3 rows
4 rows
CREATE TRIGGER trigger_1 AFTER UPDATE ON sales FOR EACH ROW EXECUTE
PROCEDURE write_log();
B. Every time 'UPDATE' is executed on the "sales" table, the "write_log" function is called once.
Options are :
a,e
a,b
b,c
c,d
Answer : a,e
A. SELECT 0 = NULL;
D. SELECT NULL;
E. SELECT 'null'::TEXT;
Options are :
a,b,d
a,b,c
b,c,d
c,d,e
Answer : a,b,d
Options are :
0 rows
4 rows
2 rows
3 rows
1 row
The tables "t1" and "t2" have columns "id" which are type of INTEGER and column "name"s which
t1
t2
The following SQL command was executed. Select the number of rows in the result. SELECT *
Options are :
2 rows
3rows
6 rows
5 rows
4 rows
A. DIRTY READ
B. READ COMMITTED
C. REPEATABLE READ
D. PHANTOM READ
E. SERIALIZABLE
Options are :
d,e
c,d
a,b
b,e
c,b
Answer : b,e
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,
Options are :
5 rows
2 rows
1 row
3 rows
4 rows
BrainDumps.
Select two reasons that are NOT the cause of this error.
Options are :
a,b
d,e
b,c
c,d
Answer : a,b
Select two incorrect statements about the function of the information schema.
postgresql.conf
Options are :
d,e
a,e
a,b
b,c
Answer : d,e
Select two correct statements from below concerning the ANALYZE command.
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.
Options are :
c,d
d,e
None
a,b
a,d
Answer : a,d
The delimiter that separates column data can be changed from the default TAB character.
You can output the row data of a table to a specified client side file.
Answer : You can output the row data of a table to a specified client side file.
Select a correct SQL command to change existing user "george"'s password to "foobar".
Options are :
ALTER USER george WITH PASSWORD 'foobar';ALTER USER george CHANGE PASSWORD
'foobar';
Answer : ALTER USER george WITH PASSWORD 'foobar';ALTER USER george CHANGE PASSWORD
'foobar';
Select one incorrect statement from the below about a database cluster.
Options are :
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.
Special databases called template0 and template1 are created in a database cluster by default.
Options are :
SELECT current_database();
SELECT version
SELECT current_date;
SELECT current_user;
SELECT current_timestamp;
C. A postmaster process creates a child process which processes the given queries.
Options are :
c,b
a,b
d,e
a,c
Answer : a,c
What does the following command do? Choose one incorrect statement from the selection below.
Options are :
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
Options are :
c,d
b,c
a,b
b,e
Answer : b,e
Select the most suitable statement about the creation of a new database
Options are :
The target directory is specified by the environment variable PGDATA or the -D parameter when
creating a database
Only one database can be used at the same time even if two or more databases are created
You can set the character encoding when creating a new database.
The following are statements related to the postmaster. Select one statement that is incorrect.
Options are :
None
It is not possible to boot up the postmaster process by directly executing the postmaster command.
Answer : It is not possible to boot up the postmaster process by directly executing the postmaster command.
What does the following command do? Choose two incorrect statements from the selection below.
A. This command restores the database database1 from the file database1.dump.
E. This command must be executed under the condition where the database database1 does
not exist.
Options are :
C,D
D,E
A,E
A,B
Answer : D,E
Select one incorrect statement concerning changes from PostgreSQL version 7.4 to 8.0.
Options are :
Based on the relationship of columns within a table, select the most suitable description that
Options are :
When the value in column B is changed, the corresponding value of column A also must be changed.
As long as column B exists, the amount of information will not decrease even if column A is deleted.
When the value in column A is changed, the corresponding value in column B also must be changed.
Answer : The value in column A is uniquely determined when a value in column B is selected
Select one incorrect statement about the command shown below. Note: $ is the command prompt.
Options are :
The same process can be performed using the SQL command "DROP USER".
Answer : If admin is not the owner of foo, an error will occur.
C. It is accessible as a table; however, it is output in binary format so it can not be read as is.
Options are :
c,d
b,c
a,b
c,e
Answer : c,e
Select one false statement about the benefits of using database management systems from
below.
Options are :
You can separate the data storage method from the application
You can separate the data search method from the application.
You can share data more easily on systems consisting of multiple computers.
You can separate the data display method from the application
You can reduce the programming workload of programming for managing data.
Answer : You can separate the data display method from the application
Select two incorrect statements related to the command below. Note: $ is the command prompt.
B. The content of the company table is written into a file called 'stdout'.
Options are :
a,b
b,d
c,d
b,c
Answer : b,d
I would like to check the privileges on the "items" table in psql. Select the most appropriate
command.
Options are :
\d items
\a items
\t items
\p items
\z items
D. Only a single character encoding can be specified for each database cluster.
Options are :
c,e
c,d
a,b
b,c
Answer : c,e
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)
Options are :
Options are :
When "auto" is designated as the value for the environment variable PGDATA, a directory is
automatically set up.
It can only be executed by the user who installed PostgreSQL.
What does the following command do? Choose the most appropriate statement from the selection
below.
Options are :
Backs up the database postgres and writes an error message to the file pgsql.
Outputs all of the content of the database postgres to the screen using the user pgsql.
Writes a backup of the entire database cluster using user postgres to the file pgsql.
Writes a backup of the entire database cluster to the file postgres and writes an error message to the file
pgsql.
Options are :
SHOW version
SELECT version;c
\server_version
SELECT version();
SHOW server;
I want to restore data from a text format backup file foo.dump. Select an appropriate command.
Options are :
psql -f foo.dump foo
A. Performance is reduced.
Options are :
a,b
b,c
a,c
c,d
Answer : a,c
Set -4
You want to delete rows in the "product" table which include the value '2004' in the "name" field.
Options are :
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
Options are :
or less, to NULL. Select the correct SQL statement to achieve this task.
Options are :
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);
Options are :
If the "record" table contains a row with an "id", the corresponding "id" row in the "master" table
cannot be deleted.
If any row exists in the "record" table, no change can be made to the "master" table
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.
Answer : If the "record" table contains a row with an "id", the corresponding "id" row in the "master" table
cannot be deleted.
Select two appropriate statements from below about the following SQL statements:
DECLARE
r text := ''default'';
BEGIN
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".
Options are :
a,e
d,e
a,b
b,c
Answer : a,e
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.
Options are :
CURSOR
INSENSITIVE CURSOR
CURSOR WITHOUT HOLD
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
----+--------
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 *
Options are :
2row
3row
4row
1 row
5row
Answer : 2row
What happens if an SQL statement syntax error occurs while a transaction is running? Select the
Options are :
The transaction is stopped and you cannot issue any SQL commands other than a command to end the
transaction
Answer : The transaction is stopped and you cannot issue any SQL commands other than a command to end
the transaction
The "sample" table consists of the data below. The column "x" is of type INTEGER. How many
Options are :
3 rows
2 rows
1 row
Which normal form has the constraint that there must be no tables with duplicate column values in
There is a table "tb1" that has a column "c1" defined as type TEXT. The following SQL is executed
BEGIN;
While the above 'SELECT' statement is being executed, client "B" connects to the same database
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".
Options are :
b,e
a,b
b,c
c,d
d,e
Answer : b,e
Options are :
VIEW
TRIGGER
CONSTRAINT
FUNCTION
RULE
Answer : RULE
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 *
Options are :
6rows
4rows
2 rows
5rows
3rows
Answer : 3rows
Options are :
CREATE TYPE
CREATE OPERATOR
CREATE FUNCTION
CREATE DATABASE
CREATE CLASS
Select the SQL command that must be executed prior to executing the EXECUTE command.
Options are :
PREPARE
CREATE FUNCTION
DECLARE
ALLOCATE
LOAD
Answer : PREPARE
A set of SQL statements were executed in the order below. Select the most appropriate statement
BEGIN;
SELECT * FROM item_simple;
END;
Options are :
No error is generated
Answer : An error is generated at the point the INSERT statement is executed.
Given the following two table definitions, select one SQL statement which will cause an error.
Options are :
SELECT data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = 1 AND s2.id = 2;
SELECT s1.id, s1.data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
SELECT id, data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
Answer : SELECT id, data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
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.
E. Software under the BSD license can be incorporated with any programs provided that the
Options are :
a,b
b,c
a,e
c,d
Answer : a,e
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".
Options are :
INTERSECT ALL
EXCEPT
NAND
INTERSECT
UNION
Answer : EXCEPT
Select the correct result generated by execution of the following SQL statements: CREATE
INSERT INTO log_01 VALUES (1, 'error', CURRENT_TIMESTAMP); SELECT * FROM log;
Options are :
'INSERT' statement generates an error stating that the number of columns and values do not match".
The present time is noon of July 7th, 2007, and the result of the following
Options are :
age(8640000
'10 day'::timestamp
'10 day'::interval
8640000::time
10::day
Answer : age(8640000
Select one incorrect description regarding the following SQL statement defining a function.
Options are :
If this function is called with a NULL parameter, it will return 0 when executed
This function operates with the authority of the user who executed it.
Answer : This function operates with the authority of the user who executed it.
How many rows are returned by executing the following SQL statement?
Options are :
1row
3row
4row
2row
5row
Answer : 3row
The table "tbl" is defined below such that it could only store non-negative integers in the column
"nn".
CREATE _______ natural_number AS DECIMAL CHECK (VALUE >= 0); CREATE TABLE tbl(nn
natural_number);
Options are :
DOMAIN
SCHEMA
VIEW
TYPE
RULE
Answer : DOMAIN
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
name TEXT
);
sales_id INTEGER,
item_id INTEGER,
num INTEGER,
);
Options are :
t1
t2
How many rows are returned by executing the following SQL statement?
3 rows
0 rows
2 rows
6 rows
5 rows
Options are :
b,c
c,e
a,b
c,d
Answer : c,e
A. END
B. ROLLBACK
C. TRUNCATE
D. ABORT
E. DROP TRANSTACTION
Options are :
b,d
a,b
c,d
b,c
Answer : b,d
Set 5
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.
Options are :
a,d
a,b
b,c
c,d
Answer : a,d
Select two suitable statements about major version upgrades of PostgreSQL from below.
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.
E. Upgrade scripts can be executed while the old version of PostgreSQL is running.
Options are :
d,e
c,d
a,b
b,c
Answer : c,d
Select an incorrect statement regarding the following SQL statement. Note that "user_view" is a
view.
Options are :
When executing 'UPDATE user_view', data is updated in the table that is the origin of the view.
Answer : When executing 'UPDATE user_view', data is updated in the table that is the origin of the view.
A. When defining a domain, you can add a default value and constraints to the original data.
Options are :
b,e
a,b
b,c
c,d
Answer : b,e
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'.
E. Creating an unused index does not affect the performance of a database at all.
Options are :
d,e
c,d
a,b
a,e
Answer : d,e
The following is the result of executing the createlang command which is installed with
PostgreSQL.
Procedural Languages
Name | Trusted?
---------+----------
plpgsql | yes
A. The procedural language plpgsql is installed in the database mydb using the above command.
C. plpgsql is a trusted language, so it can execute the OS commands on the server side.
Options are :
a,b
b,c
d,e
c,d
Answer : d,e
Options are :
d,e
b,e
a,b
c,d
b,c
Answer : b,e
You want to delete rows in the "product" table which include the value '2004' in the "name" field.
Options are :
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
Options are :
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.
Options are :
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);
Options are :
If the "record" table contains a row with an "id", the corresponding "id" row in the "master" table
cannot be deleted.
If any row exists in the "record" table, no change can be made to the "master" table
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.
Answer : If the "record" table contains a row with an "id", the corresponding "id" row in the "master" table
cannot be deleted.
Select two appropriate statements from below about the following SQL statements:
DECLARE
r text := ''default'';
BEGIN
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".
a,e
d,e
a,b
b,c
Answer : a,e
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.
Options are :
CURSOR
INSENSITIVE CURSOR
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
----+--------
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 *
Options are :
2row
3row
4row
1 row
5row
Answer : 2row
What happens if an SQL statement syntax error occurs while a transaction is running? Select the
Options are :
The transaction is stopped and you cannot issue any SQL commands other than a command to end the
transaction
The "sample" table consists of the data below. The column "x" is of type INTEGER. How many
Options are :
3 rows
2 rows
1 row
Which normal form has the constraint that there must be no tables with duplicate column values in
Options are :
There is a table "tb1" that has a column "c1" defined as type TEXT. The following SQL is executed
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
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".
Options are :
b,e
a,b
b,c
c,d
d,e
Answer : b,e
Options are :
VIEW
TRIGGER
CONSTRAINT
FUNCTION
RULE
Answer : RULE
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 *
Options are :
6rows
4rows
2 rows
5rows
3rows
Answer : 3rows
Options are :
CREATE TYPE
CREATE OPERATOR
CREATE FUNCTION
CREATE DATABASE
CREATE CLASS
Answer : CREATE TYPE
Select the SQL command that must be executed prior to executing the EXECUTE command.
Options are :
PREPARE
CREATE FUNCTION
DECLARE
ALLOCATE
LOAD
Answer : PREPARE
A set of SQL statements were executed in the order below. Select the most appropriate statement
BEGIN;
END;
Options are :
No error is generated
Given the following two table definitions, select one SQL statement which will cause an error.
Options are :
SELECT data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = 1 AND s2.id = 2;
SELECT s1.id, s1.data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
SELECT id, data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
Answer : SELECT id, data FROM sample1 AS s1, sample2 AS s2 WHERE s1.id = s2.id;
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.
E. Software under the BSD license can be incorporated with any programs provided that the
Options are :
a,b
b,c
a,e
c,d
Answer : a,e
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".
Options are :
INTERSECT ALL
EXCEPT
NAND
INTERSECT
UNION
Answer : EXCEPT
Select the correct result generated by execution of the following SQL statements: CREATE
INSERT INTO log_01 VALUES (1, 'error', CURRENT_TIMESTAMP); SELECT * FROM log;
Options are :
'INSERT' statement generates an error stating that the number of columns and values do not match".
The present time is noon of July 7th, 2007, and the result of the following
Options are :
age(8640000
'10 day'::timestamp
'10 day'::interval
8640000::time
10::day
Answer : age(8640000
Select one incorrect description regarding the following SQL statement defining a function.
Options are :
If this function is called with a NULL parameter, it will return 0 when executed
This function operates with the authority of the user who executed it.
Answer : This function operates with the authority of the user who executed it.
How many rows are returned by executing the following SQL statement?
Options are :
1row
3row
4row
2row
5row
Answer : 3row
The table "tbl" is defined below such that it could only store non-negative integers in the column
"nn".
CREATE _______ natural_number AS DECIMAL CHECK (VALUE >= 0); CREATE TABLE tbl(nn
natural_number);
Options are :
DOMAIN
SCHEMA
VIEW
TYPE
RULE
Answer : DOMAIN
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
name TEXT
);
sales_id INTEGER,
item_id INTEGER,
num INTEGER,
);
Options are :