The Java EE 5 Tutorial

The LIKE Expression

SELECT p
 FROM Player p
 WHERE p.name LIKE ’Mich%’

Data retrieved: All players whose names begin with “Mich.”

Description: The LIKE expression uses wildcard characters to search for strings that match the wildcard pattern. In this case, the query uses the LIKE expression and the % wildcard to find all players whose names begin with the string “Mich.” For example, “Michael” and “Michelle” both match the wildcard pattern.

See also: LIKE Expressions