PostgreSQL CHEAT SHEET http://www.postgresqltutorial
SELECT c1, c2 FROM t1INNER JOIN t2 ON condition;Inner join t1 and t2SELECT c1, c2 FROM t1LEFT JOIN t2 ON condition;Left join t1 and t1SELECT c1, c2 FROM t1FULL OUTER JOIN t2 ON condition;Perform full outer joinSELECT c1, c2 FROM t1CROSS JOIN t2;Produce a Cartesian product of rows in tablesSELECT c1, c2FROM t1 AINNER JOIN t2 BON condition;Join t1 to itself using INNER JOIN clauseSELECT c1, c2 FROM t1RIGHT JOIN t2 ON condition;Right join t1 and t2SELECT c1, c2 FROM t;Query data in columns c1, c2 from a tableSELECT * FROM t;Query all rows and columns from a tableSELECT c1, c2 FROM tWHERE condition;Query data and filter rows with a conditionSELECT DISTINCT c1 FROM tWHERE condition;Query distinct rows from a tableSELECT c1, aggregate(c2)FROM tGROUP BY c1;Group rows using an aggregate functionSELECT c1, aggregate(c2)FROM tGROUP BY c1HAVING condition;Filter groups using HAVING clauseSELECT c1, c2 FROM tORDER BY c1ASC [DESC];Sort the result setin ascending or descending orderSELECT c1, c2 FROM t1UNION [ALL]SELECT c1, c2 FROM t2;Combine rows from two queriesSELECT c1, c2 FROM t1INTERSECTSELECT c1, c2 FROM t2;Return the intersection of two queriesSELECT c1, c2 FROM t1EXCEPTSELECTc1, c2 FROM t2;Subtract a result set from another result setSELECT c1, c2 FROM t1WHERE c1[NOT] LIKE pattern;Query rows using pattern matching %, _SELECT c1, c2 FROM tWHERE c1 [NOT] IN value_list;Query rows in a listSELECT c1, c2 FROM tWHERE c1 BETWEEN low AND high;Query rows
CREATE INDEX idx_name ON t(c1,c2); Create an index on c1 and c2 of the table t MANAGING INDEXES CREATE VIEW v(c1,c2) AS SELECT c1, c2 FROM …
Download PostgreSQL CHEAT SHEET http://www.postgresqltutorial
Information
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
Related search queries
ArcSDE Administration for PostgreSQL, PostgreSQL, PostgreSQL Installation Guide, Security Best Practices for Postgres, Using the NoSQL Capabilities in Postgres, Converting from SAS® Table Server to a PostgreSQL Database, Server to a PostgreSQL Database, PostgreSQL: Introduction and Concepts, PostgreSQL Introduction and Concepts, Introduction, Hacking PostgreSQL, Internals Of PostgreSQL