Used to return just one row of identical rows:
mysql> select DISTINCT Town from Students; +---------+ | Town | +---------+ | London | | Watford | | Croydon | | Hook | | Manc | | Cheam | +---------+ 6 rows in set (0.00 sec) |
Query ran upon:
mysql> select * from Students; +----+-------+---------+-----+---------+------+----------+-------+ | id | First | Surname | Age | Town | PIN | Study | Score | +----+-------+---------+-----+---------+------+----------+-------+ | 1 | Pam | Frost | 21 | London | 1065 | MySQL | 98 | | 2 | James | Cross | 20 | Watford | 7519 | Music | 88 | | 3 | Andy | Jones | 34 | Croydon | 8198 | Markets | 64 | | 4 | David | Smith | 42 | London | 0151 | Antiques | 82 | | 5 | Julia | James | 17 | London | 2108 | Maths | 77 | | 6 | Phil | Watson | 36 | Hook | 9437 | Cars | 44 | | 7 | Terry | Waite | 58 | Manc | 2643 | Music | 59 | | 8 | Alex | Rose | 49 | Cheam | 0672 | C | 70 | +----+-------+---------+-----+---------+------+----------+-------+ 8 rows in set (0.00 sec) |
Notice the duplicate Town field with London for records 1,4 & 5