Example: marketing

PostgreSQL - Tutorialspoint

PostgreSQL i About the Tutorial PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. PostgreSQL runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. This tutorial will give you quick start with PostgreSQL and make you comfortable with PostgreSQL programming. Audience This tutorial has been prepared for the beginners to help them understand the basic to advanced concepts related to PostgreSQL Database.

PostgreSQL i About the Tutorial PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong

Tags:

  Tutorialspoint, Postgresql

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of PostgreSQL - Tutorialspoint

1 PostgreSQL i About the Tutorial PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. PostgreSQL runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. This tutorial will give you quick start with PostgreSQL and make you comfortable with PostgreSQL programming. Audience This tutorial has been prepared for the beginners to help them understand the basic to advanced concepts related to PostgreSQL Database.

2 Prerequisites Before you start practicing with various types of examples given in this reference, I'm making an assumption that you are already aware about what is database, especially RDBMS and what is a computer programming language. Copyright & Disclaimer Copyright 2017 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors.

3 Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at PostgreSQL ii Table of Contents About the Tutorial .. i Audience .. i Prerequisites .. i Copyright & Disclaimer .. i Table of Contents .. ii 1. PostgreSQL Overview .. 1 Brief History .. 1 Key Features of 2 Procedural Languages Support .. 2 2. PostgreSQL Environment Setup .. 3 Installing PostgreSQL on Linux/Unix .. 3 Installing PostgreSQL on Windows .. 4 Installing PostgreSQL on Mac.

4 7 3. PostgreSQL Syntax .. 11 The SQL Statement .. 11 PostgreSQL SQL commands .. 11 4. PostgreSQL Data Type .. 35 Numeric Types .. 35 Monetary Types .. 36 Character Types .. 36 Binary Data Types .. 37 Date/Time Types .. 37 Boolean Type .. 37 Enumerated Type .. 38 Geometric Type .. 38 Network Address Type .. 38 Bit String Type .. 39 Text Search Type .. 39 UUID Type .. 39 XML Type .. 39 JSON Type .. 40 Array Type .. 40 Composite Types .. 41 Range Types .. 42 Object Identifier Types .. 43 Pseudo Types .. 43 5. PostgreSQL CREATE Database .. 45 Using createdb Command .. 45 6. PostgreSQL SELECT Database .. 48 Database SQL Prompt .. 48 OS Command Prompt.

5 49 7. PostgreSQL DROP Database .. 50 Using dropdb Command .. 51 PostgreSQL iii 8. PostgreSQL CREATE Table .. 53 9. PostgreSQL DROP Table .. 55 10. PostgreSQL Schema .. 56 Syntax to Create Table in Schema .. 56 Syntax to Drop Schema .. 57 11. PostgreSQL INSERT Query .. 58 12. PostgreSQL SELECT Query .. 60 13. PostgreSQL Operators .. 62 PostgreSQL Arithmetic Operators .. 62 PostgreSQL Comparison Operators .. 64 PostgreSQL Logical Operators .. 66 PostgreSQL Bit String Operators .. 69 14. PostgreSQL 71 PostgreSQL Boolean Expressions .. 71 PostgreSQL Numeric Expression .. 72 PostgreSQL Date Expressions .. 73 15. PostgreSQL WHERE Clause.

6 74 16. PostgreSQL AND & OR Conjunctive Operators .. 79 The AND Operator .. 79 The OR Operator .. 80 17. PostgreSQL UPDATE Query .. 82 18. PostgreSQL DELETE Query .. 84 19. PostgreSQL LIKE Clause .. 86 20. PostgreSQL LIMIT Clause .. 89 21. PostgreSQL ORDER BY Clause .. 91 22. PostgreSQL GROUP BY .. 94 23. PostgreSQL WITH Clause .. 97 Recursive WITH .. 97 24. PostgreSQL HAVING Clause .. 101 25. PostgreSQL DISTINCT Keyword .. 104 ADVANCED PostgreSQL .. 107 26. PostgreSQL CONSTRAINTS .. 108 NOT NULL Constraint .. 108 UNIQUE Constraint .. 109 PostgreSQL iv PRIMARY KEY Constraint .. 109 FOREIGN KEY Constraint .. 110 CHECK Constraint.

7 111 EXCLUSION Constraint .. 111 Dropping Constraints .. 112 27. PostgreSQL JOINS .. 113 The CROSS JOIN .. 114 The INNER JOIN .. 115 The LEFT OUTER JOIN .. 116 The RIGHT OUTER JOIN .. 117 The FULL OUTER JOIN .. 117 28. PostgreSQL UNIONS Clause .. 119 The UNION ALL Clause .. 121 29. PostgreSQL NULL Values .. 123 30. PostgreSQL ALIAS 126 31. PostgreSQL TRIGGERS .. 129 Listing TRIGGERS .. 132 Dropping TRIGGERS .. 132 32. PostgreSQL INDEXES .. 133 Index Types .. 133 The DROP INDEX Command .. 135 When Should Indexes be Avoided? .. 135 33. PostgreSQL ALTER TABLE Command .. 136 34. PostgreSQL TRUNCATE TABLE Command .. 139 35.

8 PostgreSQL VIEWS .. 140 Creating Views .. 140 Dropping Views .. 142 36. PostgreSQL TRANSACTIONS .. 143 Transaction Control .. 143 The COMMIT Command .. 144 The ROLLBACK Command .. 144 37. PostgreSQL LOCKS .. 146 DeadLocks .. 146 Advisory Locks .. 147 38. PostgreSQL Sub Queries .. 148 Subqueries with the SELECT Statement .. 148 Subqueries with the INSERT Statement .. 149 Subqueries with the UPDATE Statement .. 150 Subqueries with the DELETE Statement .. 151 39. PostgreSQL AUTO INCREMENT .. 153 PostgreSQL v 40. PostgreSQL PRIVILEGES .. 155 41. PostgreSQL DATE/TIME Functions and Operators .. 158 42. PostgreSQL Functions.

9 166 43. PostgreSQL Useful Functions .. 168 PostgreSQL COUNT Function .. 168 PostgreSQL MAX Function .. 169 PostgreSQL MIN Function .. 171 PostgreSQL AVG Function .. 172 PostgreSQL SUM Function .. 173 PostgreSQL Array Function .. 174 PostgreSQL Numeric Function .. 175 PostgreSQL STRING Function .. 185 PostgreSQL INTERFACES .. 197 44. PostgreSQL C/C++ Interface .. 198 Installation .. 198 C/C++ Interface APIs .. 199 Connecting To Database .. 200 Create a Table .. 201 INSERT Operation .. 202 SELECT Operation .. 204 UPDATE Operation .. 206 DELETE Operation .. 208 45. PostgreSQL JAVA Interface .. 211 Installation .. 211 Connecting To Database.

10 211 Create a Table .. 212 INSERT Operation .. 213 SELECT Operation .. 215 UPDATE Operation .. 217 DELETE Operation .. 219 46. PostgreSQL PHP Interface .. 222 Installation .. 222 PHP Interface APIs .. 222 Connecting to Database .. 224 Create a Table .. 225 INSERT Operation .. 226 SELECT Operation .. 227 UPDATE Operation .. 228 DELETE Operation .. 230 47. PostgreSQL Perl Interface .. 233 Installation .. 233 DBI Interface APIs .. 234 Connecting to Database .. 235 Create a Table .. 235 PostgreSQL vi INSERT Operation .. 236 SELECT Operation .. 237 UPDATE Operation .. 239 DELETE Operation .. 240 48. PostgreSQL Python Interface .. 243 Installation.


Related search queries