w3resource
SQL exercises

SQL: Filter rows using not like and % character

SQL Wildcard & Special Operator : Exercise-19 with Solution

Write a SQL statement to find those rows from the table testtable which does not contain the character ( % ) in its column 'col1'.

Sample table: testtable


Sample Solution :

SELECT *
FROM testtable
WHERE col1 NOT LIKE '%/%%' ESCAPE'/';

Output of the Query:

col1
A001/DJ-402\44_/100/2015
A001_\DJ-402\44_/100/2015
A001_DJ-402-2014-2015
A002_DJ-401-2014-2015
A001/DJ_401
A001/DJ_402\44
A001/DJ_402\44\2015
A001/DJ-402\44

Explanation :

Syntax of filter rows using not like and % character

Pictorial presentation :

Exercise: Filter rows using not like and % character

Query Visualization:

Duration:

Query visualization of Filter rows using not like and % character - Duration

Rows:

Query visualization of Filter rows using not like and % character - Rows

Cost:

Query visualization of Filter rows using not like and % character - Cost

 

Practice Online


Contribute your code and comments through Disqus.

Previous: Write a SQL statement to find those rows from the table testtable which contain the character ( % ) in its column 'col1'.
Next: Write a SQL statement to find that customer with all information who does not get any grade except NULL.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming