Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

PostgreSQL DISTINCT

The PostgreSQL DISTINCT keyword is used in conjunction with SELECT statement to eliminate all the duplicate records and fetching only unique records.
There may be a situation when you have multiple duplicate records in a table. While fetching such records, it makes more sense to fetch only unique records instead of fetching duplicate records.
postgres=# SELECT name FROM tab1;           
 name  
-------
 nijam
 abu
 umar
 jamal
 abu
(5 rows)
-- From above table  tab1 having one duplicate values "name=ABU" is duplicate so DISTINCT  clause used to show without duplicate values. 
postgres=# SELECT DISTINCT(name) FROM tab1; 
 name  
-------
 umar
 jamal
 nijam
 abu
(4 rows)
















Comments

Popular posts from this blog

7 Steps to configure BDR replication in postgresql

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

apt-add-repository

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated ORA-01262: Stat failed on a file destination directory Linux-x86_64 Error: 2: No such file or directory