w3resource
SQL exercises

SQL: Filter records using where clause and or operator

SQL Wildcard & Special Operator : Exercise-1 with Solution

Write a SQL statement to find those salesmen with all information who come from the city either Paris or Rome. 

Sample table: salesman


Sample Solution:

SELECT * 
FROM salesman 
WHERE city = 'Paris' OR city = 'Rome';

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

Explanation:

Syntax of filter records using where clause and or operator

Pictorial presentation :

Result of filter records using where clause and or operator

Query Visualization:

Duration:

Query visualization of Filter records using where clause and or operator - Duration

Rows:

Query visualization of Filter records using where clause and or operator - Rows

Cost:

Query visualization of Filter records using where clause and or operator - Cost

 

Practice Online


Contribute your code and comments through Disqus.

Previous: SQL Wildcard and Special operators Exercises Home
Next: Write a query to filter those salesmen with all information who comes from any of the cities Paris and Rome.

What is the difficulty level of this exercise?



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