SQL Regular Expression

Question

Get all employee detail from EmployeeDetail table whose
“FirstName” not start with any single character between ‘a-p’

solved 1
TheDataMonk 55 years 5 Answers 1979 views Grand Master 0

Answers ( 5 )

  1. Select * from EmployeeDetail where FirstName
    LIKE ‘[^a-p]%’

  2. select * from EmployeeDetail WHERE FirstName LIKE ‘[!a-p]%’;

    Best answer
  3. Select FirstName from EmployeeDetail
    where FirstName regexp ‘^[^a-p]’

    1st ^ – matches the position at the beginning of the searched string
    2nd^ – matches any character not specified inside the square brackets

  4. USING LIKE Operator
    Select * from Table
    where First_Name LIKE ‘[!a-p]%’

    USING Regular Expression
    select * from Table
    where First_Name REGEXP ‘^[^a-p]%’

Leave an answer

Browse
Browse