w3resource
SQL exercises

SQL: Using where, like and underscore operators

SQL Wildcard & Special Operator : Exercise-11 with Solution

Write a SQL statement to find those salesmen with all information whose name containing the 1st character is 'N' and the 4th character is 'l' and rests may be any character.

Sample table : salesman


Sample Solution :

SELECT *
FROM salesman
WHERE name LIKE 'N__l%';

Output of the Query:

salesman_id	name		city	commission
5002		Nail Knite	Paris	0.13

Explanation :

Syntax of SQL wildcard and special operator

Pictorial presentation :

Exercise: SQL wildcard and special operator

Query Visualization:

Duration:

Query visualization of Using where, like and underscore operators - Duration

Rows:

Query visualization of Using where, like and underscore operators - Rows

Cost:

Query visualization of Using where, like and underscore operators - Cost

 

Practice Online


Contribute your code and comments through Disqus.

Previous: Write a SQL statement to find all those customers with all information whose names are ending with the letter 'n'.
Next: Write a SQL statement to find those rows from the table testtable which contain the escape character underscore ( _ ) in its column 'col1'.

What is the difficulty level of this exercise?



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