w3resource
SQL exercises

SQL Exercises: Find the number of salesman currently listing for all of their customers

SQL Aggregate Functions: Exercise-3 with Solution

Write a SQL statement to find the number of salesman currently listing for all of their customers.

Sample table: orders


Sample Solution:

SELECT COUNT (DISTINCT salesman_id) 
FROM orders;

Output of the Query:

count
6

Explanation:

Syntax of find the number of salesman currently listing for all of their customers

Pictorial presentation:

Find the number of salesman currently listing for all of their customers

Practice Online


Query Visualization:

Duration:

Query visualization of Find the number of salesman currently listing for all of their customers - Duration

Rows:

Query visualization of Find the number of salesman currently listing for all of their customers - Rows

Cost:

Query visualization of Find the number of salesman currently listing for all of their customers - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a SQL statement to find the average purchase amount of all orders.
Next: Write a SQL statement to know how many customers have listed their names.

What is the difficulty level of this exercise?



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