Query to determine if columns combine to create a unique key
oracle, sql
Solution
Use the `HAVING` clause to easily identify duplicates.
select t.a, t.b, t.c, count(1)
from my_table t
group by t.a, t.b, t.c
having count(1) > 1;
Problem
I'm trying to determine if a set of three columns on a table in Oracle would constitute a unique key and could be used in a 1:1 relationship. If I run this query, and the keys are a unique combination, I should not see a `count` > 1, correct? ``` select count(*) from my_table t group by t.a, t.b, t.c ``` Is there a better/alternative way to make this determination?