From the course: MySQL Data Analysis

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

SELECT DISTINCT

SELECT DISTINCT

- [Instructor] All right, now that you know how to select data from columns, let's introduce SELECT DISTINCT. When you run a SELECT DISTINCT, you'll return just the distinct or unique values that are in those columns. If you include multiple columns in a SELECT DISTINCT, your results set will return all distinct combinations of values across those columns. So, instead of just returning the five unique values in one column and the five unique values in the other column, you may get 25 different distinct permutations of the values in those two columns. Here's a big pro tip. I use SELECT DISTINCT all the time to quickly see all the values that are in a column. It's really handy to quickly get your head around a data set. Here's what the syntax looks like. You incorporate DISTINCT after your SELECT, and before the column names that you're interested in. Let's open up Workbench and walk through a few examples now. So, first, I'm going to do a SELECT star from our film table, so that here…

Contents