Unique keyword vs Distinct in Oracle

I am a little confused about using these words. I have a table with the following columns: SITE, LAT, LONG, NAME, ......

I need results with unique (or it's different) LAT, LONG. How to achieve this?

+2
source share
4 answers
select unique colA, colB from atable

select distinct colA, colB from atable

In this context, unique and different mean the same thing.

It differs, however, by the ANSI standard, while it is not unique.

Note that unique has many other meanings when used in another area, i.e. index creation etc.

+8
source

UNIQUE is used to define data restrictions that can be stored in a table.

DISTINCT , .

+1

I always like to count how many of each unique element there are, so I would:

select lat, long, count (lat) from the group lat, long table, but thats just me

+1
source

AFAIR both mean the same thing. To get unique LIV and LONG from your table, simply do:

SELECT DISTINCT LAT, LONG FROM table;

0
source

All Articles