Consider the below is the table name “student”
1 | a
2 | b
3 | c
4 | a
5 | d
6 | b
7 | e
Now there are plenty of duplicate records in the above table right?.
Showing the duplicate records is easy in MySQL if you use GROUP BY in the SQL Query you will get it easily.
But have you ever tried to get only non-duplicate records from a table?.
In the above table if you see the records in the column ‘name’. a,b is repeated two times. c,d,e are not repeated right?.
So, how can you show only c,d,e from the above table?. Don’t worry i will explain how can you do it!
Below Query will help you to get what you are looking for..
SELECT s_id, name FROM table GROUP BY name HAVING COUNT(*) = 1;
I hope now you get a clear idea of what to do right?. Okay then try and let me know if you have any doubt.