II. SQL 언어

여기서는 PostgreSQL에서 사용하는 SQL 언어에 대해서 다룬다. 먼저, SQL의 일반적인 구문을 설명하며, 이어, 데이터베이스를 만드는 법, 자료를 보관하기 위한 테이블 만들기, 자료 입력, 수정, 삭제와 같은 작업들, 그리고, 저장되어있는 자료를 찾아보는 방법을 다루며, 중반부에서는 다루는 자료형과, SQL 명령에서 사용할 수 있는 함수들에 대해서 다룬다. 끝부분에서는 데이터베이스가 최적의 성능을 발휘할 수 있는 각종 튜닝 방법들을 소개한다.

이 문서는 초보자가 다른 참고 사항들을 살펴 볼 필요 없이, 처음부터 차근히 읽어가면 SQL 전반에 대해서 모든 정보를 습득할 수 있도록 구성되었다. 또한 각 장들은 그 장에서 다루고 있는 부분들이 서로 다른 장에 걸쳐 연결되어 있지 않아서, 이미 어느 정도 SQL에 대해서 알고 있는 사람이라면, 관심 분야만 바로 살펴볼 수 있도록 작성되었다. 또한 안내서의 성격을 가지고 있어, 쉽게 읽어 갈 수 있도록 엄격한 언어 정의 부분들은 피했다. 해당 정보의 완벽한 설명이 필요하다면, VI 부를 참조하시라.

이 문서를 읽는 사람은 최소한 PostgreSQL 데이터베이스 접속은 어떻게하며, SQL 명령을 어떻게 사용하는지 정도는 알고 있어야한다. 이 부분에 대한 이야기는 I 부에서 다루고 있다. 여기서 예제로 보여지는 내용들은 PostgreSQL 대화형 터미널인 psql에서 다룬 것들이다. 이 점을 감안하고, 독자들은 자신이 쓰는 것에 맞추어 읽어가면 될 것이다.

차례
4. SQL Syntax
4.1. Lexical Structure
4.2. Value Expressions
5. Data Definition
5.1. Table Basics
5.2. Default Values
5.3. Constraints
5.4. System Columns
5.5. Modifying Tables
5.6. Privileges
5.7. Schemas
5.8. Inheritance
5.9. Partitioning
5.10. Other Database Objects
5.11. 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
7.7. VALUES Lists
8. 자료형
8.1. 숫자 자료형
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. Composite Types
8.12. Object Identifier Types
8.13. Pseudo-Types
8.14. XML Document Support
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. Bit String Functions and Operators
9.7. Pattern Matching
9.8. Data Type Formatting Functions
9.9. Date/Time Functions and Operators
9.10. Geometric Functions and Operators
9.11. Network Address Functions and Operators
9.12. Sequence Manipulation Functions
9.13. Conditional Expressions
9.14. Array Functions and Operators
9.15. Aggregate Functions
9.16. Subquery Expressions
9.17. Row and Array Comparisons
9.18. Set Returning Functions
9.19. System Information Functions
9.20. System Administration Functions
10. Type Conversion
10.1. Overview
10.2. Operators
10.3. Functions
10.4. Value Storage
10.5. UNION, CASE, and Related Constructs
11. Indexes
11.1. Introduction
11.2. Index Types
11.3. Multicolumn Indexes
11.4. Combining Multiple Indexes
11.5. Unique Indexes
11.6. Indexes on Expressions
11.7. Partial Indexes
11.8. Operator Classes
11.9. 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