Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

PostgreSQL INTERSECT

PostgreSQL INTERSECT clause/operator is used to combine the results of two or more SELECT statements with returning duplicate(COMMON) rows ONLY.
postgres=# select * from tab1; postgres=# select * from tab2;
 id | name                              id |  name  
----+-------                           ----+--------
  1 | nijam                              1 | jamal
  2 | abu                                2 | smith
  3 | umar                               4 | daniel
  7 | jamal                              5 | zaheer
(4 rows)                               (4 rows)
-- From above table  tab1 and tab2 having one duplicate values "name=jamal" is duplicate so INTERSECT  clause shows only COMMON rows (7,jamal). 
postgres=# SELECT name FROM tab1 INTERSECT SELECT name FROM tab2;

 name  
-------
 jamal
(1 row)   










Comments

Popular posts from this blog

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

PostgreSQL DOMAIN Data Type -2

10. Global Sequences

Oracle to Postgresql migration

How to Configure Oracle Dataguard and How to Perform Switchover and Failover