How to handle duplicate data in SQL?

Right now, will find out about the copy information and the procedure to deal with it in SQL.

The DISTINCT watchword uses to choose records which are particular. Utilizing the DISTINCT catchphrase is basic and sweet as we just need to Use it after SELECT watchword and rest will be dealt with by the database.

This is can be the situation with you that your table must contain the records with copy information. At certain focuses, we don’t need all the information however just barely any records which will have DISTINCT keys.

The Usage of DISTINCT catchphrase is as follow, as we just to accomplish something like this:

SELECT DISTINCT name FROM A;

What this inquiry will do is, it will get all the records from the table A however on the off chance that the name is rehashed on various occasions it will just choose it once and we will have an outcome with records which are not copy in nature.

Sham information:

How to handle duplicate data in SQL?

Syntax:

SELECT DISTINCT c1, c2, ...,  cN 
FROM t
WHERE [condition]

Example 1 – Without utilizing DISTINCT keyword

SELECT SALARY FROM 'JustTechReview'.'employee' 
ORDER BY SALARY;
How to handle duplicate data in SQL?

Example 2 – utilizing DISTINCT keyword

SELECT DISTINCT SALARY FROM 'JustTechReview'.'employee' 
ORDER BY SALARY;
How to handle duplicate data in SQL?

Example 3 – utilizing DISTINCT keyword

SELECT DISTINCT AGE FROM 'JustTechReview'.'employee' 
ORDER BY AGE;
How to handle duplicate data in SQL?

Leave a Comment

error: Alert: Content is protected!!