ITPEC FE Morning April 2021 Question 27

Topic: DatabasesAlso asked in April 2026

A student’s ID, name, and class ID are recorded in the Student table. Which of the following SQL returns records of all students whose names start with A?

Explanation

name LIKE 'A%' — the literal A is fixed at the start and the wildcard after it matches whatever follows.

In a LIKE pattern, % matches any sequence of characters, including none, and _ matches exactly one character. So 'A%' reads 'A, then anything': it matches Anna, Ali and a name that is just A.

Answer (d)

Why not others:

  • •(a) — '%A' is 'anything, then A', so it returns names that end with A
  • •(b) — '%A_' puts A in the second-to-last position, followed by exactly one character
  • •(c) — 'A_' matches only two-character names that begin with A; Anna would not match

Key rule: The position of % sets the anchor: a trailing % means 'starts with', a leading % means 'ends with', % on both sides means 'contains', and _ stands for exactly one character.

Databases · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.