SELECT DISTINCT with WHERE Clause
In this method, we are going to perform similar kind of operation as we have done in ‘method 1‘ but this time we will work with some specified data. We will use WHERE clause along with the SELECT DISTINCT statement.
Query:
SELECT DISTINCT score, course
from w3wiki
WHERE course IN ('Java','JavaScript');
Output:
Explanation: In the above image, we can clearly notice that all the values are unique. This is the similar kind of operation we have performed in ‘method 1’. This time we have specified that we only want data from the table where course have ‘Java’ and ‘JavaScript‘ in them.
How to SELECT DISTINCT on Multiple Columns in SQL?
In the world of databases, data duplication can lead to confusion and inefficiency. SQL provides a powerful tool, SELECT DISTINCT, to retrieve unique values from columns. However, when dealing with multiple columns, the approach becomes more detailed.
In this article, We will explore How to SELECT DISTINCT on multiple columns in SQL by understanding various methods along with the practical implementation and so on.