From the course: Oracle Database 12c: Basic SQL
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using DISTINCT to eliminate duplicates - Oracle Database Tutorial
From the course: Oracle Database 12c: Basic SQL
Using DISTINCT to eliminate duplicates
- [Narrator] We can use the distinct keyword as part of your sequel query to filter out duplicate rows. Let's start with a very simple query. Let's say we want to see all of the distinct department id values that we have in our employees table. Simply typing select department id from employees and running the query, produced us with a list of all department id values we see a lot of duplicates. As you can see, for example, department id 50 repeats multiple times. That's because each department has multiple employees assigned to that department. For example, department id 50 has multiple employees assigned to it, so we see this value repeats multiple time in our query, not a very convenient way to see all of the distinct department id values we have in our employees table. We can fix that by simply adding the distinct keyword between our select keyword and the list of table columns. Using distinct as part of our sequel query will filter out any duplicate values in the data that is…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Writing your first SELECT query1m 56s
-
(Locked)
Selecting only specific columns2m 22s
-
(Locked)
Using WHERE to filter specific rows1m 55s
-
(Locked)
Using multiple WHERE conditions3m 55s
-
(Locked)
Using WHERE to filter partial strings3m 12s
-
(Locked)
Using WHERE to filter numeric ranges1m 17s
-
(Locked)
Using WHERE IN and NOT IN for strings1m 54s
-
(Locked)
Using WHERE IN and NOT IN for numbers1m 35s
-
(Locked)
Using WHERE to filter dates2m 42s
-
(Locked)
Using WHERE to filter exact strings1m 55s
-
(Locked)
Using DISTINCT to eliminate duplicates4m
-
(Locked)
Performing basic numeric calculations2m 23s
-
(Locked)
Using column aliases2m 18s
-
(Locked)
Describe the structure of a table3m 16s
-
(Locked)
Using ORDER BY3m 29s
-
-
-
-
-
-
-