Friday, April 15, 2016

SQL Like Syntax

SQL Programming language LIKE syntax use for search a specific pattern in a table column.Like clause use wildcard operators for compare a value.There two wildcard operators use in LIKE. They are  percent sign %  and underscore (-).This symbol use in combination. Percent sign represent multiple character ,zero ,one. Underscore represent single character or number.

Example:

In this query just come the result which student name begin with E

SELECT * FROM students
WHERE
Name LIKE   ‘E%’;

In this query just come the result which student name end with E

SELECT * FROM students
WHERE
Name LIKE   ‘%E’;

In this query just come the result which student name has no  ER .

SELECT * FROM students
WHERE
Name Not  LIKE   ‘%ER%’;

In this query just come the result which student roll has 2 in second position.

SELECT * FROM students
WHERE
Roll  LIKE   ‘_2%’;

No comments:

Post a Comment