pattern matching in sql with example