how to display employee names starting with a and then b in sql

前端 未结 12 1616
谎友^
谎友^ 2021-02-05 19:58

i want to display the employee names which having names start with a and b ,it should be like list will display employees with \'a\' as a first letter and then the \'b\' as a

12条回答
  •  不思量自难忘°
    2021-02-05 20:48

    Here what I understood from the question is starting with "a " and then "b" ex:

    • abhay
    • abhishek
    • abhinav

    So there should be two conditions and both should be true means you cant use "OR" operator Ordered by is not not compulsory but its good if you use.

    Select e_name from emp 
    where  e_name like 'a%' AND e_name like '_b%'
    Ordered by e_name
    

提交回复
热议问题