Sunday, June 26, 2011

How do you find the list of employees named "john" in an employee table without using Like operator??

This question seems tricky.. but yes there is another way by which we can find names/patters without using like operator.
By using "BETWEEN" , we can find the lsit of employees named john...
sel * from employee where name betwee 'J' and 'K';

But at times usage of between is tricky, if there are other employees starting with J, those employees will also be listed by this query.

2 comments:

  1. We can use Equal(=) operator to find the name "john"
    i.e. SELECT NAME
    FROM EMPLOYEES
    WHERE NAME = 'john';

    ReplyDelete
  2. Actually the question was regarding pattern matching concept... We can also use in , between and exclusion also...

    ReplyDelete