1

Is it possible to use following pattern in the Query to get the below results?

1.To get all the employee details where Employee number is 8 digits with starting letter as K and rest as integers

Eg: K1234567

SELECT * 
FROM EMPLOYEE 
WHERE EMP_NO LIKE '[K\d{7}]'

PS: I did not get the desired result by running the query, please suggest if there is anything wrong here.

1 Answer 1

2

Yes this is possible with the pattern below

SELECT *
FROM   EMPLOYEE
WHERE  EMP_NO LIKE 'K' + REPLICATE('[0-9]',7) 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.