SQL Wildcard and Special Operator: Using between operator to get a value from a range - w3resource
w3resource
SQL exercises

SQL: Using between operator to get a value from a range

SQL Wildcard & Special Operator : Exercise-5 with Solution

Write a SQL statement to find those salesmen with all information who get the commission within a range of 0.12 and 0.14.

Sample Solution:

SELECT * 
FROM salesman 
WHERE commission BETWEEN 0.12 AND 0.14;

Output of the Query:

salesman_id	name		city	commission
5002		Nail Knite	Paris	0.13
5006		Mc Lyon		Paris	0.14
5007		Paul Adam	Rome	0.13
5003		Lauson Hen	San Jose0.12

Explanation:

Syntax of a value from a range using between operator

Pictorial presentation :

Result of a value from a range using between operator

Query Visualization:

Duration:

Query visualization of Using between operator to get a value from a range - Duration

Rows:

Query visualization of Using between operator to get a value from a range - Rows

Cost:

Query visualization of Using between operator to get a value from a range - Cost

 

Practice Online


Contribute your code and comments through Disqus.

Previous: Write a query to sort out those customers with all information whose ID value is within any of 3007, 3008 and 3009.
Next: Write a query to filter all those orders with all information which purchase amount value is within the range 500 and 4000 except those orders of purchase amount value 948.50 and 1983.43.

What is the difficulty level of this exercise?