The DISTINCT clause is used to retrieve the unique of different values of the columns of the table that contain duplicate values in their column. Listing 8 shows a query that determines the count of DISTINCT or UNIQUE (a keyword you can use instead of DISTINCT) MANAGER column values in the EMPLOYEE table. select colA from your_table union select colB from your_table; Update: If you want to find the duplicate then use the EXISTS as follows: SELECT COLA, COLB FROM YOUR_TABLE T1 WHERE EXISTS (SELECT 1 FROM YOUR_tABLE T2 WHERE T2.COLA = T1.COLB OR T2.COLB = T1.COLA) The issue is with this line . Term for people who believe God once existed but then disappeared? The ORDER BY clause allows you to sort data by multiple columns where each column may have different sort orders. What is special about the area 30 km west of Beijing? Re: DISTINCT: single vs multiple columns L. Fernigrini Sep 30, 2019 3:20 PM ( in response to eeps ) Yes, DISTINCT affects all the data being returned, as John show you. Generating random samples obeying the exponential distribution with a given min and max. Supposing we have a table with four columns (a,b,c,d) of the same data type. tables The tables that you wish to retrieve records from.