This page in other versions: 8.4 / 9.0 / 9.1 / 9.2 / 9.3  |  Development versions: devel  |  Unsupported versions: 7.1 / 7.4 / 8.0 / 8.1 / 8.2 / 8.3

II. The SQL Language

This part describes the use of the SQL language in PostgreSQL. We start with describing the general syntax of SQL, then explain how to create the structures to hold data, how to populate the database, and how to query it. The middle part lists the available data types and functions for use in SQL data commands. The rest treats several aspects that are important for tuning a database for optimal performance.

The information in this part is arranged so that a novice user can follow it start to end to gain a full understanding of the topics without having to refer forward too many times. The chapters are intended to be self-contained, so that advanced users can read the chapters individually as they choose. The information in this part is presented in a narrative fashion in topical units. Readers looking for a complete description of a particular command should look into Part VI.

Readers of this part should know how to connect to a PostgreSQL database and issue SQL commands. Readers that are unfamiliar with these issues are encouraged to read Part I first. SQL commands are typically entered using the PostgreSQL interactive terminal psql, but other programs that have similar functionality can be used as well.

Table of Contents
4. SQL Syntax
4.1. Lexical Structure
4.2. Value Expressions
5. Data Definition
5.1. Table Basics
5.2. System Columns
5.3. Default Values
5.4. Constraints
5.5. Inheritance
5.6. Modifying Tables
5.7. Privileges
5.8. Schemas
5.9. Other Database Objects
5.10. Dependency Tracking
6. Data Manipulation
6.1. Inserting Data
6.2. Updating Data
6.3. Deleting Data
7. Queries
7.1. Overview
7.2. Table Expressions
7.3. Select Lists
7.4. Combining Queries
7.5. Sorting Rows
7.6. LIMIT and OFFSET
8. Data Types
8.1. Numeric Types
8.2. Monetary Types
8.3. Character Types
8.4. Binary Data Types
8.5. Date/Time Types
8.6. Boolean Type
8.7. Geometric Types
8.8. Network Address Types
8.9. Bit String Types
8.10. Arrays
8.11. Object Identifier Types
8.12. Pseudo-Types
9. Functions and Operators
9.1. Logical Operators
9.2. Comparison Operators
9.3. Mathematical Functions and Operators
9.4. String Functions and Operators
9.5. Binary String Functions and Operators
9.6. Pattern Matching
9.7. Data Type Formatting Functions
9.8. Date/Time Functions and Operators
9.9. Geometric Functions and Operators
9.10. Network Address Type Functions
9.11. Sequence-Manipulation Functions
9.12. Conditional Expressions
9.13. Miscellaneous Functions
9.14. Array Functions and Operators
9.15. Aggregate Functions
9.16. Subquery Expressions
9.17. Row and Array Comparisons
10. Type Conversion
10.1. Overview
10.2. Operators
10.3. Functions
10.4. Value Storage
10.5. UNION, CASE, and ARRAY Constructs
11. Indexes
11.1. Introduction
11.2. Index Types
11.3. Multicolumn Indexes
11.4. Unique Indexes
11.5. Indexes on Expressions
11.6. Operator Classes
11.7. Partial Indexes
11.8. Examining Index Usage
12. Concurrency Control
12.1. Introduction
12.2. Transaction Isolation
12.3. Explicit Locking
12.4. Data Consistency Checks at the Application Level
12.5. Locking and Indexes
13. Performance Tips
13.1. Using EXPLAIN
13.2. Statistics Used by the Planner
13.3. Controlling the Planner with Explicit JOIN Clauses
13.4. Populating a Database
Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group