208k views
1 vote
What does this SQL statement return? SELECT name FROM students WHERE name REGEXP '^to';

a) Names starting with 'to'
b) Names containing 'to' anywhere
c) Names not starting with 'to'
d) Names ending with 'to'

1 Answer

4 votes

Final answer:

The SQL statement provided returns names of students starting with 'to' as it uses the REGEXP function with the '^' metacharacter which denotes the beginning of a string.

Step-by-step explanation:

The SQL statement SELECT name FROM students WHERE name REGEXP '^to' returns the names of students that start with 'to'. The REGEXP is used here for a regular expression pattern match, and the caret sign (^) is a metacharacter that matches the start of a string. Therefore, the correct answer to this question is a) Names starting with 'to'.

User Vladimir Panchenko
by
7.7k points