]> begriffs open source - ai-pg/blob - full-docs/txt/sql.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql.txt
1
2 Part II. The SQL Language
3
4    This part describes the use of the SQL language in PostgreSQL. We start
5    with describing the general syntax of SQL, then how to create tables,
6    how to populate the database, and how to query it. The middle part
7    lists the available data types and functions for use in SQL commands.
8    Lastly, we address several aspects of importance for tuning a database.
9
10    The information is arranged so that a novice user can follow it from
11    start to end and gain a full understanding of the topics without having
12    to refer forward too many times. The chapters are intended to be
13    self-contained, so that advanced users can read the chapters
14    individually as they choose. The information is presented in narrative
15    form with topical units. Readers looking for a complete description of
16    a particular command are encouraged to review the Part VI.
17
18    Readers should know how to connect to a PostgreSQL database and issue
19    SQL commands. Readers that are unfamiliar with these issues are
20    encouraged to read Part I first. SQL commands are typically entered
21    using the PostgreSQL interactive terminal psql, but other programs that
22    have similar functionality can be used as well.
23
24    Table of Contents
25
26    4. SQL Syntax
27
28         4.1. Lexical Structure
29         4.2. Value Expressions
30         4.3. Calling Functions
31
32    5. Data Definition
33
34         5.1. Table Basics
35         5.2. Default Values
36         5.3. Identity Columns
37         5.4. Generated Columns
38         5.5. Constraints
39         5.6. System Columns
40         5.7. Modifying Tables
41         5.8. Privileges
42         5.9. Row Security Policies
43         5.10. Schemas
44         5.11. Inheritance
45         5.12. Table Partitioning
46         5.13. Foreign Data
47         5.14. Other Database Objects
48         5.15. Dependency Tracking
49
50    6. Data Manipulation
51
52         6.1. Inserting Data
53         6.2. Updating Data
54         6.3. Deleting Data
55         6.4. Returning Data from Modified Rows
56
57    7. Queries
58
59         7.1. Overview
60         7.2. Table Expressions
61         7.3. Select Lists
62         7.4. Combining Queries (UNION, INTERSECT, EXCEPT)
63         7.5. Sorting Rows (ORDER BY)
64         7.6. LIMIT and OFFSET
65         7.7. VALUES Lists
66         7.8. WITH Queries (Common Table Expressions)
67
68    8. Data Types
69
70         8.1. Numeric Types
71         8.2. Monetary Types
72         8.3. Character Types
73         8.4. Binary Data Types
74         8.5. Date/Time Types
75         8.6. Boolean Type
76         8.7. Enumerated Types
77         8.8. Geometric Types
78         8.9. Network Address Types
79         8.10. Bit String Types
80         8.11. Text Search Types
81         8.12. UUID Type
82         8.13. XML Type
83         8.14. JSON Types
84         8.15. Arrays
85         8.16. Composite Types
86         8.17. Range Types
87         8.18. Domain Types
88         8.19. Object Identifier Types
89         8.20. pg_lsn Type
90         8.21. Pseudo-Types
91
92    9. Functions and Operators
93
94         9.1. Logical Operators
95         9.2. Comparison Functions and Operators
96         9.3. Mathematical Functions and Operators
97         9.4. String Functions and Operators
98         9.5. Binary String Functions and Operators
99         9.6. Bit String Functions and Operators
100         9.7. Pattern Matching
101         9.8. Data Type Formatting Functions
102         9.9. Date/Time Functions and Operators
103         9.10. Enum Support Functions
104         9.11. Geometric Functions and Operators
105         9.12. Network Address Functions and Operators
106         9.13. Text Search Functions and Operators
107         9.14. UUID Functions
108         9.15. XML Functions
109         9.16. JSON Functions and Operators
110         9.17. Sequence Manipulation Functions
111         9.18. Conditional Expressions
112         9.19. Array Functions and Operators
113         9.20. Range/Multirange Functions and Operators
114         9.21. Aggregate Functions
115         9.22. Window Functions
116         9.23. Merge Support Functions
117         9.24. Subquery Expressions
118         9.25. Row and Array Comparisons
119         9.26. Set Returning Functions
120         9.27. System Information Functions and Operators
121         9.28. System Administration Functions
122         9.29. Trigger Functions
123         9.30. Event Trigger Functions
124         9.31. Statistics Information Functions
125
126    10. Type Conversion
127
128         10.1. Overview
129         10.2. Operators
130         10.3. Functions
131         10.4. Value Storage
132         10.5. UNION, CASE, and Related Constructs
133         10.6. SELECT Output Columns
134
135    11. Indexes
136
137         11.1. Introduction
138         11.2. Index Types
139         11.3. Multicolumn Indexes
140         11.4. Indexes and ORDER BY
141         11.5. Combining Multiple Indexes
142         11.6. Unique Indexes
143         11.7. Indexes on Expressions
144         11.8. Partial Indexes
145         11.9. Index-Only Scans and Covering Indexes
146         11.10. Operator Classes and Operator Families
147         11.11. Indexes and Collations
148         11.12. Examining Index Usage
149
150    12. Full Text Search
151
152         12.1. Introduction
153         12.2. Tables and Indexes
154         12.3. Controlling Text Search
155         12.4. Additional Features
156         12.5. Parsers
157         12.6. Dictionaries
158         12.7. Configuration Example
159         12.8. Testing and Debugging Text Search
160         12.9. Preferred Index Types for Text Search
161         12.10. psql Support
162         12.11. Limitations
163
164    13. Concurrency Control
165
166         13.1. Introduction
167         13.2. Transaction Isolation
168         13.3. Explicit Locking
169         13.4. Data Consistency Checks at the Application Level
170         13.5. Serialization Failure Handling
171         13.6. Caveats
172         13.7. Locking and Indexes
173
174    14. Performance Tips
175
176         14.1. Using EXPLAIN
177         14.2. Statistics Used by the Planner
178         14.3. Controlling the Planner with Explicit JOIN Clauses
179         14.4. Populating a Database
180         14.5. Non-Durable Settings
181
182    15. Parallel Query
183
184         15.1. How Parallel Query Works
185         15.2. When Can Parallel Query Be Used?
186         15.3. Parallel Plans
187         15.4. Parallel Safety