Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

PostgreSQL UNION ALL

UNION ALL operator is used to combine the results of two SELECT statements including duplicate rows.
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 UNION ALL clause shows all rows including duplicate rows
postgres=# select * from tab1 union all select *from tab2;   
 id |  name  
----+--------
  1 | nijam
  2 | abu
  3 | umar
  7 | jamal
  1 | jamal
  2 | smith
  4 | daniel
  5 | zaheer
(8 rows)





Comments

Popular posts from this blog

postgreSQL Compress format backup

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

Top 10 Highest Paying URL Shortener Companies - Best URL Shorteners To Earn Fast

7 Steps to configure BDR replication in postgresql

Postgres Streaming Replication Configuration