How is the pattern matching done in the SQL?