nerdexam
PostgreSQL_CE

PGCES-02 · Question #20

The table "t1" is defined by the following SQL statement: CREATE TABLE t1 (id integer, name varchar(20)); PostgreSQL CE PGCES-02 Exam You want to increase the execution speed of the SQL statement…

The correct answer is A. CREATE INDEX t1_idx ON t1 (id,upper(name)). See the full explanation below for the reasoning.

Question

The table "t1" is defined by the following SQL statement:

CREATE TABLE t1 (id integer, name varchar(20)); PostgreSQL CE PGCES-02 Exam You want to increase the execution speed of the SQL statement below:

SELECT id, name FROM t1 WHERE id < 123 AND upper(name) = 'MAMMOTH'; Select the most suitable SQL statement to create an index.

Options

  • ACREATE INDEX t1_idx ON t1 (id,upper(name));
  • BCREATE INDEX t1_idx ON t1 USING HASH (id);
  • CCREATE INDEX t1_idx ON t1 (name);
  • DALTER TABLE ADD INDEX ON t1 (id,upper(name));
  • EALTER TABLE ADD INDEX ON t1 (id, name);

How the community answered

(54 responses)
  • A
    81% (44)
  • B
    2% (1)
  • C
    2% (1)
  • D
    11% (6)
  • E
    4% (2)

Community Discussion

No community discussion yet for this question.

Full PGCES-02 Practice