62.1k views
0 votes
To retrieve rows in which an expression matches a string pattern called a mask, you can use the ______________ keyword followed by the mask.

a. SELECT
b. FROM
c. BETWEEN
d. LIKE
e. ORDER BY

1 Answer

4 votes

Final answer:

To retrieve rows matching a string pattern, you can use the LIKE keyword in a SQL query. The LIKE keyword allows for wildcard searches with '%' and '_', providing flexibility in matching patterns within the database.

Step-by-step explanation:

To retrieve rows in which an expression matches a string pattern called a mask, you can use the LIKE keyword followed by the mask. For example, in a SQL query, if you want to find all entries in a table where a column 'name' starts with 'A', you would write something like:

SELECT * FROM table_name WHERE name LIKE 'A%';

The percent sign (%) in the LIKE clause acts as a wildcard, which matches any sequence of characters. You might also use an underscore (_) as a wildcard to match any single character. Using the LIKE keyword effectively allows for more complex patterns and criteria in retrieving data from a database.

User Harmeet
by
6.7k points