RIGHT JOIN two tables ON : Right Join « Table Joins « PostgreSQL

Home
PostgreSQL
1.Aggregate Functions
2.Analytical Functions
3.Array
4.Constraints
5.Cursor
6.Data Type
7.Database
8.Date Timezone
9.Index
10.Inheritance
11.Insert Delete Update
12.Math Functions
13.Postgre SQL
14.Select Query
15.Sequence
16.Store Procedure Function
17.String Functions
18.Subquery
19.Table
20.Table Joins
21.Transaction
22.User Previliege
23.View
PostgreSQL » Table Joins » Right Join 




RIGHT JOIN two tables ON


postgres=#
postgres=# CREATE TABLE t2 (
postgres(#     num         int,
postgres(#     name       varchar(10)
postgres();
CREATE TABLE
postgres=#
postgres=# insert into t2 values(1,'xxx');
INSERT 0 1
postgres=# insert into t2 values(3,'yyy');
INSERT 0 1
postgres=# insert into t2 values(5,'zzz');
INSERT 0 1
postgres=#
postgres=# SELECT FROM t1 RIGHT JOIN t2 ON t1.num = t2.num;
 num | name | num | name
-----+------+-----+------
   | a    |   | xxx
   | c    |   | yyy
     |      |   | zzz
(rows)

postgres=#
postgres=# drop table t1;
DROP TABLE
postgres=# drop table t2;
DROP TABLE
postgres=#
postgres=#

           
       














Related examples in the same category
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.