Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
Using like and in sql together in Queries of SQL Queries
2407 Views
Hints 
"like" used in where condition with column and values.Opposite to this "not like" also available.

"and" used to compare two column values in where condition.If both condition statisfies select command select the column which is related to that conditions.

"or" used to compare two column values in where condition.If any one condition statisfies select command select the column which is related to that conditions.

In following example like, and , or are used together according to the purpose of task.
Syntax
select columnName  from tableName where  (columnName like'value' or columnName like 'value' ) and columnName like 'value'  ;
Example
Get the employee numbers and first names of all employees whose last names have a letter o or a as
the second character and end with the letters es.

select emp_no,emp_fname from Empolyee where  (emp_lname like'_o%' or emp_lname like '_a%' )
and emp_lname like '%es'  ;
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details