没有合适的资源?快使用搜索试试~ 我知道了~
首页PostgreSQL.官方文档
PostgreSQL.官方文档
5星 · 超过95%的资源 需积分: 9 17 下载量 173 浏览量
更新于2023-03-03
评论
收藏 11.37MB PDF 举报
PostgreSQL.官方文档 ,详细介绍PostgreSQL ,是很好的学习PostgreSQL的工具。
资源详情
资源评论
资源推荐
PostgreSQL 8.1.0 Documentation
The PostgreSQL Global Development Group
PostgreSQL 8.1.0 Documentation
by The PostgreSQL Global Development Group
Copyright © 1996-2005 The PostgreSQL Global Development Group
Legal Notice
PostgreSQL is Copyright © 1996-2005 by the PostgreSQL Global Development Group and is distributed under the terms of the license of the
University of California below.
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 ..........................................................................................................................................xxxiii
1. What is PostgreSQL? .......................................................................................................xxxiii
2. A Brief History of PostgreSQL........................................................................................ xxxiv
2.1. The Berkeley POSTGRES Project ...................................................................... xxxiv
2.2. Postgres95............................................................................................................ xxxiv
2.3. PostgreSQL........................................................................................................... xxxv
3. Conventions....................................................................................................................... xxxv
4. Further Information..........................................................................................................xxxvi
5. Bug Reporting Guidelines................................................................................................xxxvi
5.1. Identifying Bugs .................................................................................................xxxvii
5.2. What to report.....................................................................................................xxxvii
5.3. Where to report bugs ........................................................................................... xxxix
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 ................................................................................................................. 6
2.1. Introduction ................................................................................................................6
2.2. Concepts ..................................................................................................................... 6
2.3. Creating a New Table .................................................................................................6
2.4. Populating a Table With Rows ................................................................................... 7
2.5. Querying a Table ........................................................................................................ 8
2.6. Joins Between Tables................................................................................................ 10
2.7. Aggregate Functions................................................................................................. 12
2.8. Updates ..................................................................................................................... 13
2.9. Deletions................................................................................................................... 14
3. Advanced Features ................................................................................................................ 15
3.1. Introduction ..............................................................................................................15
3.2. Views ........................................................................................................................ 15
3.3. Foreign Keys............................................................................................................. 15
3.4. Transactions.............................................................................................................. 16
3.5. Inheritance ................................................................................................................ 18
3.6. Conclusion................................................................................................................ 19
II. The SQL Language...................................................................................................................... 21
4. SQL Syntax ........................................................................................................................... 23
4.1. Lexical Structure....................................................................................................... 23
4.1.1. Identifiers and Key Words............................................................................ 23
4.1.2. Constants...................................................................................................... 24
4.1.2.1. String Constants .............................................................................. 24
4.1.2.2. Dollar-Quoted String Constants ...................................................... 25
4.1.2.3. Bit-String Constants ........................................................................ 26
4.1.2.4. Numeric Constants .......................................................................... 26
4.1.2.5. Constants of Other Types ................................................................ 27
4.1.3. Operators...................................................................................................... 28
4.1.4. Special Characters........................................................................................ 28
4.1.5. Comments .................................................................................................... 29
iii
4.1.6. Lexical Precedence ......................................................................................29
4.2. Value Expressions..................................................................................................... 30
4.2.1. Column References...................................................................................... 31
4.2.2. Positional Parameters................................................................................... 31
4.2.3. Subscripts..................................................................................................... 32
4.2.4. Field Selection .............................................................................................32
4.2.5. Operator Invocations.................................................................................... 32
4.2.6. Function Calls .............................................................................................. 33
4.2.7. Aggregate Expressions................................................................................. 33
4.2.8. Type Casts .................................................................................................... 34
4.2.9. Scalar Subqueries......................................................................................... 35
4.2.10. Array Constructors..................................................................................... 35
4.2.11. Row Constructors.......................................................................................36
4.2.12. Expression Evaluation Rules ..................................................................... 37
5. Data Definition...................................................................................................................... 39
5.1. Table Basics.............................................................................................................. 39
5.2. Default Values .......................................................................................................... 40
5.3. Constraints................................................................................................................ 41
5.3.1. Check Constraints ........................................................................................ 41
5.3.2. Not-Null Constraints.................................................................................... 43
5.3.3. Unique Constraints....................................................................................... 44
5.3.4. Primary Keys................................................................................................ 44
5.3.5. Foreign Keys ................................................................................................ 45
5.4. System Columns....................................................................................................... 48
5.5. Modifying Tables...................................................................................................... 49
5.5.1. Adding a Column......................................................................................... 49
5.5.2. Removing a Column .................................................................................... 50
5.5.3. Adding a Constraint ..................................................................................... 50
5.5.4. Removing a Constraint ................................................................................ 50
5.5.5. Changing a Column’s Default Value............................................................ 51
5.5.6. Changing a Column’s Data Type ................................................................. 51
5.5.7. Renaming a Column .................................................................................... 51
5.5.8. Renaming a Table ........................................................................................ 51
5.6. Privileges .................................................................................................................. 52
5.7. Schemas.................................................................................................................... 52
5.7.1. Creating a Schema ....................................................................................... 53
5.7.2. The Public Schema ...................................................................................... 54
5.7.3. The Schema Search Path.............................................................................. 54
5.7.4. Schemas and Privileges................................................................................ 55
5.7.5. The System Catalog Schema .......................................................................56
5.7.6. Usage Patterns.............................................................................................. 56
5.7.7. Portability..................................................................................................... 56
5.8. Inheritance ................................................................................................................ 57
5.8.1. Caveats......................................................................................................... 59
5.9. Partitioning ............................................................................................................... 60
5.9.1. Overview...................................................................................................... 60
5.9.2. Implementing Partitioning ........................................................................... 61
5.9.3. Partitioning and Constraint Exclusion ......................................................... 64
5.10. Other Database Objects .......................................................................................... 65
5.11. Dependency Tracking............................................................................................. 66
6. Data Manipulation................................................................................................................. 67
6.1. Inserting Data ........................................................................................................... 67
iv
6.2. Updating Data........................................................................................................... 68
6.3. Deleting Data............................................................................................................ 68
7. Queries .................................................................................................................................. 70
7.1. Overview .................................................................................................................. 70
7.2. Table Expressions ..................................................................................................... 70
7.2.1. The FROM Clause.......................................................................................... 71
7.2.1.1. Joined Tables ................................................................................... 71
7.2.1.2. Table and Column Aliases............................................................... 74
7.2.1.3. Subqueries ....................................................................................... 75
7.2.1.4. Table Functions ...............................................................................75
7.2.2. The WHERE Clause........................................................................................ 76
7.2.3. The GROUP BY and HAVING Clauses........................................................... 77
7.3. Select Lists................................................................................................................ 79
7.3.1. Select-List Items .......................................................................................... 79
7.3.2. Column Labels............................................................................................. 80
7.3.3. DISTINCT .................................................................................................... 80
7.4. Combining Queries................................................................................................... 81
7.5. Sorting Rows ............................................................................................................ 81
7.6. LIMIT and OFFSET................................................................................................... 82
8. Data Types............................................................................................................................. 84
8.1. Numeric Types.......................................................................................................... 85
8.1.1. Integer Types................................................................................................ 86
8.1.2. Arbitrary Precision Numbers ....................................................................... 86
8.1.3. Floating-Point Types .................................................................................... 87
8.1.4. Serial Types.................................................................................................. 88
8.2. Monetary Types ........................................................................................................ 89
8.3. Character Types ........................................................................................................ 89
8.4. Binary Data Types .................................................................................................... 91
8.5. Date/Time Types....................................................................................................... 93
8.5.1. Date/Time Input ........................................................................................... 94
8.5.1.1. Dates................................................................................................ 94
8.5.1.2. Times............................................................................................... 95
8.5.1.3. Time Stamps.................................................................................... 96
8.5.1.4. Intervals........................................................................................... 97
8.5.1.5. Special Values ................................................................................. 97
8.5.2. Date/Time Output ........................................................................................98
8.5.3. Time Zones ..................................................................................................98
8.5.4. Internals........................................................................................................ 99
8.6. Boolean Type.......................................................................................................... 100
8.7. Geometric Types..................................................................................................... 100
8.7.1. Points ......................................................................................................... 101
8.7.2. Line Segments............................................................................................101
8.7.3. Boxes.......................................................................................................... 101
8.7.4. Paths........................................................................................................... 102
8.7.5. Polygons..................................................................................................... 102
8.7.6. Circles ........................................................................................................ 102
8.8. Network Address Types.......................................................................................... 103
8.8.1. inet ........................................................................................................... 103
8.8.2. cidr ........................................................................................................... 103
8.8.3. inet vs. cidr............................................................................................ 104
8.8.4. macaddr .................................................................................................... 104
8.9. Bit String Types ...................................................................................................... 105
v
剩余1448页未读,继续阅读
younideshijie
- 粉丝: 0
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 2023年中国辣条食品行业创新及消费需求洞察报告.pptx
- 2023年半导体行业20强品牌.pptx
- 2023年全球电力行业评论.pptx
- 2023年全球网络安全现状-劳动力资源和网络运营的全球发展新态势.pptx
- 毕业设计-基于单片机的液体密度检测系统设计.doc
- 家用清扫机器人设计.doc
- 基于VB+数据库SQL的教师信息管理系统设计与实现 计算机专业设计范文模板参考资料.pdf
- 官塘驿林场林防火(资源监管)“空天地人”四位一体监测系统方案.doc
- 基于专利语义表征的技术预见方法及其应用.docx
- 浅谈电子商务的现状及发展趋势学习总结.doc
- 基于单片机的智能仓库温湿度控制系统 (2).pdf
- 基于SSM框架知识产权管理系统 (2).pdf
- 9年终工作总结新年计划PPT模板.pptx
- Hytera海能达CH04L01 说明书.pdf
- 数据中心运维操作标准及流程.pdf
- 报告模板 -成本分析与报告培训之三.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1