w3resource
SQL exercises

SQL: Find the last name of all employees, without duplicates

SQL Basic Select Statement : Exercise-31 with Solution.

Write a query in SQL to find the last name of all employees, without duplicates.

Sample table: emp_details


Sample Solution:

SELECT DISTINCT emp_lname
FROM emp_details;

Output:

ignored duplicate employees

Query Visualization:

Duration:

Query visualization of Find the last name of all employees, without duplicates - Duration

Rows:

Query visualization of Find the last name of all employees, without duplicates - Rows

Cost:

Query visualization of Find the last name of all employees, without duplicates - Cost

Practice Online


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

Previous: Write a SQL query to find the name and price of the cheapest item.
Next: Write a query in SQL to find the data of employees whose last name is 'Snares'.

What is the difficulty level of this exercise?



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