II. The SQL Language

This part describes the use of the SQL language in EnterpriseDB. 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 Reference.

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

Table of Contents
3. SQL Syntax
3.1. Lexical Structure
3.2. Value Expressions
4. Data Definition
4.1. Table Basics
4.2. System Columns
4.3. Default Values
4.4. Constraints
4.5. Modifying Tables
4.6. Privileges
4.7. Schemas
4.8. Other Database Objects
4.9. Dependency Tracking
5. Data Manipulation
5.1. Inserting Data
5.2. Updating Data
5.3. Deleting Data
6. Queries
6.1. Overview
6.2. Table Expressions
6.3. Select Lists
6.4. Combining Queries
6.5. Sorting Rows
6.6. LIMIT and OFFSET
7. Data Types
7.1. Numeric Types
7.2. Character Types
7.3. Binary Data
7.4. Date/Time Types
7.5. Boolean Type
8. Functions and Operators
8.1. Logical Operators
8.2. Comparison Operators
8.3. Mathematical Functions and Operators
8.4. String Functions and Operators
8.5. Binary String Functions and Operators
8.6. Pattern Matching
8.7. Data Type Formatting Functions
8.8. Date/Time Functions and Operators
8.9. Sequence Manipulation Functions
8.10. Conditional Expressions
8.11. Aggregate Functions
8.12. Subquery Expressions
8.13. Set Returning Functions
8.14. System Information Functions
8.15. System Administration Functions
9. Type Conversion
9.1. Explicit Data Type Conversion
9.2. Implicit Data Type Conversion
9.3. General Conversion Rules
10. Indexes
10.1. Introduction
10.2. Index Types
10.3. Multicolumn Indexes
10.4. Unique Indexes
10.5. Indexes on Expressions
10.6. Operator Classes
10.7. Partial Indexes
10.8. Examining Index Usage
11. Concurrency Control
11.1. Introduction
11.2. Transaction Isolation
11.3. Explicit Locking
11.4. Data Consistency Checks at the Application Level
11.5. Locking and Indexes
12. Performance Tips
12.1. Using EXPLAIN
12.2. Statistics Used by the Planner
12.3. Controlling the Planner with Explicit JOIN Clauses
12.4. Populating a Database