Chrome Extension

Get distinct records MySQL

SELECT DISTINCT
    column_name1, column_name2
FROM
    table_name;
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

DISTINCT clause in MYSQL is used to get record which are not duplicate to others. You can find distinct records from a table in MySQL using DISTINCT clause.

Example

If there is a table named students which has two columns named first_name and last_name and there are some records which has duplicate entry in first_name column.

If you want to get all the records where first_name column records are not same then run below query

SELECT DISTINCT first_name FROM students;

To get distinct records by first_name and last_name combination run below.

SELECT DISTINCT first_name, last_name FROM students;
Was this helpful?
0 Comments
Open Code Manager We are hiring