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

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

7 Steps to configure BDR replication in postgresql

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

PostgreSQL Introduction

ERROR: operator does not exist: text ->> unknown LINE 1: ...stomer' as customer_name,sales_info ->>'PRODUCTS' ->>'produc... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.