没有合适的资源?快使用搜索试试~ 我知道了~
首页postgre使用方法介绍
postgre使用方法介绍
1星 需积分: 49 18 下载量 196 浏览量
更新于2023-05-28
评论
收藏 8.47MB PDF 举报
postgre使用介绍,以及软件安装方法。postgre使用介绍,以及软件安装方法。postgre使用介绍,以及软件安装方法
资源详情
资源评论
资源推荐
PostgreSQL 9.6.4 Documentation
The PostgreSQL Global Development Group
PostgreSQL 9.6.4 Documentation
by The PostgreSQL Global Development Group
Copyright © 1996-2017 The PostgreSQL Global Development Group
Legal Notice
PostgreSQL is Copyright © 1996-2017 by the PostgreSQL Global Development Group.
Postgres95 is Copyright © 1994-5 by the Regents of the University of California.
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written
agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all
copies.
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE
AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PRO-
VIDED HEREUNDER IS ON AN “AS-IS” BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Table of Contents
Preface .............................................................................................................................................lxix
1. What is PostgreSQL?..........................................................................................................lxix
2. A Brief History of PostgreSQL............................................................................................lxx
2.1. The Berkeley POSTGRES Project ..........................................................................lxx
2.2. Postgres95................................................................................................................lxx
2.3. PostgreSQL.............................................................................................................lxxi
3. Conventions.........................................................................................................................lxxi
4. Further Information............................................................................................................lxxii
5. Bug Reporting Guidelines..................................................................................................lxxii
5.1. Identifying Bugs ...................................................................................................lxxiii
5.2. What to Report .....................................................................................................lxxiii
5.3. Where to Report Bugs ...........................................................................................lxxv
I. Tutorial............................................................................................................................................. 1
1. Getting Started ........................................................................................................................1
1.1. Installation .................................................................................................................. 1
1.2. Architectural Fundamentals........................................................................................ 1
1.3. Creating a Database....................................................................................................2
1.4. Accessing a Database .................................................................................................3
2. The SQL Language .................................................................................................................5
2.1. Introduction ................................................................................................................5
2.2. Concepts .....................................................................................................................5
2.3. Creating a New Table ................................................................................................. 5
2.4. Populating a Table With Rows ...................................................................................6
2.5. Querying a Table ........................................................................................................7
2.6. Joins Between Tables..................................................................................................9
2.7. Aggregate Functions.................................................................................................11
2.8. Updates..................................................................................................................... 12
2.9. Deletions................................................................................................................... 13
3. Advanced Features................................................................................................................14
3.1. Introduction ..............................................................................................................14
3.2. Views ........................................................................................................................14
3.3. Foreign Keys.............................................................................................................14
3.4. Transactions.............................................................................................................. 15
3.5. Window Functions.................................................................................................... 17
3.6. Inheritance ................................................................................................................ 20
3.7. Conclusion................................................................................................................21
II. The SQL Language......................................................................................................................22
4. SQL Syntax...........................................................................................................................24
4.1. Lexical Structure.......................................................................................................24
4.1.1. Identifiers and Key Words............................................................................24
4.1.2. Constants......................................................................................................26
4.1.2.1. String Constants ..............................................................................26
4.1.2.2. String Constants with C-style Escapes............................................ 26
4.1.2.3. String Constants with Unicode Escapes.......................................... 28
4.1.2.4. Dollar-quoted String Constants.......................................................28
4.1.2.5. Bit-string Constants......................................................................... 29
4.1.2.6. Numeric Constants .......................................................................... 29
4.1.2.7. Constants of Other Types ................................................................30
iii
4.1.3. Operators......................................................................................................31
4.1.4. Special Characters........................................................................................31
4.1.5. Comments ....................................................................................................32
4.1.6. Operator Precedence ....................................................................................32
4.2. Value Expressions.....................................................................................................33
4.2.1. Column References......................................................................................34
4.2.2. Positional Parameters...................................................................................34
4.2.3. Subscripts.....................................................................................................35
4.2.4. Field Selection ............................................................................................. 35
4.2.5. Operator Invocations....................................................................................36
4.2.6. Function Calls..............................................................................................36
4.2.7. Aggregate Expressions.................................................................................37
4.2.8. Window Function Calls................................................................................39
4.2.9. Type Casts....................................................................................................41
4.2.10. Collation Expressions ................................................................................ 41
4.2.11. Scalar Subqueries.......................................................................................42
4.2.12. Array Constructors.....................................................................................42
4.2.13. Row Constructors.......................................................................................44
4.2.14. Expression Evaluation Rules ..................................................................... 45
4.3. Calling Functions......................................................................................................47
4.3.1. Using Positional Notation............................................................................ 47
4.3.2. Using Named Notation ................................................................................ 48
4.3.3. Using Mixed Notation..................................................................................48
5. Data Definition......................................................................................................................50
5.1. Table Basics.............................................................................................................. 50
5.2. Default Values .......................................................................................................... 51
5.3. Constraints................................................................................................................52
5.3.1. Check Constraints ........................................................................................52
5.3.2. Not-Null Constraints....................................................................................54
5.3.3. Unique Constraints.......................................................................................55
5.3.4. Primary Keys................................................................................................56
5.3.5. Foreign Keys................................................................................................56
5.3.6. Exclusion Constraints .................................................................................. 59
5.4. System Columns.......................................................................................................59
5.5. Modifying Tables......................................................................................................61
5.5.1. Adding a Column.........................................................................................61
5.5.2. Removing a Column ....................................................................................62
5.5.3. Adding a Constraint .....................................................................................62
5.5.4. Removing a Constraint ................................................................................ 62
5.5.5. Changing a Column’s Default Value............................................................63
5.5.6. Changing a Column’s Data Type .................................................................63
5.5.7. Renaming a Column .................................................................................... 63
5.5.8. Renaming a Table ........................................................................................ 63
5.6. Privileges ..................................................................................................................64
5.7. Row Security Policies............................................................................................... 64
5.8. Schemas....................................................................................................................69
5.8.1. Creating a Schema ....................................................................................... 70
5.8.2. The Public Schema ...................................................................................... 71
5.8.3. The Schema Search Path..............................................................................71
5.8.4. Schemas and Privileges................................................................................72
5.8.5. The System Catalog Schema ....................................................................... 72
5.8.6. Usage Patterns..............................................................................................73
iv
5.8.7. Portability.....................................................................................................73
5.9. Inheritance ................................................................................................................ 74
5.9.1. Caveats.........................................................................................................77
5.10. Partitioning .............................................................................................................77
5.10.1. Overview....................................................................................................77
5.10.2. Implementing Partitioning .........................................................................78
5.10.3. Managing Partitions................................................................................... 81
5.10.4. Partitioning and Constraint Exclusion .......................................................82
5.10.5. Alternative Partitioning Methods...............................................................83
5.10.6. Caveats.......................................................................................................84
5.11. Foreign Data ........................................................................................................... 85
5.12. Other Database Objects .......................................................................................... 85
5.13. Dependency Tracking............................................................................................. 85
6. Data Manipulation................................................................................................................. 88
6.1. Inserting Data ...........................................................................................................88
6.2. Updating Data...........................................................................................................89
6.3. Deleting Data............................................................................................................ 90
6.4. Returning Data From Modified Rows ...................................................................... 90
7. Queries .................................................................................................................................. 92
7.1. Overview ..................................................................................................................92
7.2. Table Expressions .....................................................................................................92
7.2.1. The FROM Clause.......................................................................................... 93
7.2.1.1. Joined Tables ...................................................................................93
7.2.1.2. Table and Column Aliases...............................................................97
7.2.1.3. Subqueries ....................................................................................... 98
7.2.1.4. Table Functions ...............................................................................98
7.2.1.5. LATERAL Subqueries .......................................................................99
7.2.2. The WHERE Clause......................................................................................101
7.2.3. The GROUP BY and HAVING Clauses......................................................... 101
7.2.4. GROUPING SETS, CUBE, and ROLLUP .......................................................104
7.2.5. Window Function Processing .................................................................... 106
7.3. Select Lists.............................................................................................................. 106
7.3.1. Select-List Items ........................................................................................ 107
7.3.2. Column Labels........................................................................................... 107
7.3.3. DISTINCT ..................................................................................................108
7.4. Combining Queries.................................................................................................108
7.5. Sorting Rows ..........................................................................................................109
7.6. LIMIT and OFFSET.................................................................................................110
7.7. VALUES Lists ..........................................................................................................110
7.8. WITH Queries (Common Table Expressions) .........................................................111
7.8.1. SELECT in WITH.........................................................................................111
7.8.2. Data-Modifying Statements in WITH .........................................................115
8. Data Types........................................................................................................................... 117
8.1. Numeric Types........................................................................................................118
8.1.1. Integer Types.............................................................................................. 119
8.1.2. Arbitrary Precision Numbers .....................................................................119
8.1.3. Floating-Point Types..................................................................................121
8.1.4. Serial Types................................................................................................ 122
8.2. Monetary Types ......................................................................................................123
8.3. Character Types ......................................................................................................124
8.4. Binary Data Types .................................................................................................. 126
8.4.1. bytea Hex Format.....................................................................................126
v
剩余3368页未读,继续阅读
qq_16769573
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1