Red Hat Database

SQL Guide and Reference

ISBN: N/A
Table of Contents
I. SQL Guide
1. SQL Syntax
Lexical Structure
Lexical Precedence
Value Expressions
Queries
Indexes
Inheritance
Columns
2. Data Types
Numeric Types
Monetary Type
Character Types
Binary Strings
Date/Time Types
Boolean Type
Geometric Types
Network Address Data Types
Bit String Types
Large Objects (LOBs)
Arrays
Type Conversion
3. Operators and Functions
Logical Operators
Comparison Operators
Mathematical Functions and Operators
Aggregate Functions
String Functions and Operators
Binary String Functions and Operators
Pattern Matching
Formatting Functions
Date/Time Functions and Operators
Geometric Functions and Operators
Network Address Type Functions
Large Object Functions
Sequence-Manipulation Functions
Miscellaneous Functions
Subquery Expressions
4. Extending SQL
Background on Extensibility and Types
Functions
Triggers
User-Defined Types
Operators
Indexes and User-Defined Types
Aggregates
II. SQL Commands
5. Reference
ABORT --  Aborts the current transaction
ALTER GROUP --  Adds users to a group, removes users from a group
ALTER TABLE -- Modifies table properties
ALTER USER --  Modifies user account information
ANALYZE --  Collects statistics about a database
BEGIN --  Begins a transaction in chained mode
CHECKPOINT -- Forces a transaction log checkpoint
CLOSE --  Closes a cursor
CLUSTER -- Clusters a table according to an index
COMMENT --  Adds or modifies a comment to an object
COMMIT --  Commits the current transaction
COPY --  Copies data between files and tables
CREATE AGGREGATE --  Defines a new aggregate function
CREATE CONSTRAINT TRIGGER --  Creates a trigger to support a constraint
CREATE DATABASE --  Creates a new database
CREATE FUNCTION --  Defines a new function
CREATE GROUP --  Defines a new user group
CREATE INDEX --  Defines a new index
CREATE LANGUAGE --  Defines a new language for functions
CREATE OPERATOR --  Defines a new operator
CREATE RULE --  Defines a new rewrite rule
CREATE SEQUENCE --  Creates a new sequence number generator.
CREATE TABLE --  Defines a new table
CREATE TABLE AS --  Defines a new table from the results of a query
CREATE TRIGGER --  Defines a new trigger
CREATE TYPE --  Defines a new data type
CREATE USER --  Defines a new database user account
CREATE VIEW --  Defines a new view
DECLARE --  Defines a cursor
DELETE --  Removes rows from a table
DROP AGGREGATE --  Removes the definition of an aggregate function
DROP DATABASE --  Removes an existing database
DROP FUNCTION --  Removes a user-defined C function
DROP GROUP --  Removes a group
DROP INDEX --  Removes existing indexes from a database
DROP LANGUAGE --  Removes a user-defined procedural language.
DROP OPERATOR --  Removes an operator from the database
DROP RULE --  Removes existing rules from the database
DROP SEQUENCE --  Removes existing sequences from a database
DROP TABLE --  Removes existing tables from a database
DROP TRIGGER --  Removes an existing trigger
DROP TYPE --  Removes user-defined types from the system catalogs
DROP USER --  Removes a user
DROP VIEW --  Removes existing views from a database.
END --  Commits the current transaction
EXPLAIN --  Shows a statement execution plan.
FETCH --  Gets rows using a cursor
GRANT -- Defines access privileges
INSERT --  Inserts new rows into a table.
LISTEN --  Listens for a response on a notify condition
LOAD --  Dynamically loads an object file
LOCK --  Explicitly locks a table inside a transaction
MOVE --  Moves cursor position
NOTIFY --  Signals all frontends and backends listening on a notify condition
REINDEX --  Recovers corrupted system indexes under stand-alone PostgreSQL
RESET -- Restores run-time parameters to default values
REVOKE --  Revokes access privilege from a specific user, a group of users, or all users.
ROLLBACK --  Aborts the current transaction
SELECT --  Retrieves rows from a table or view
SET -- Sets run-time parameters
SET CONSTRAINTS -- Sets the constraint mode of the current SQL transaction
SET SESSION AUTHORIZATION -- Sets the session user identifier and the current user identifier of the current session
SET TRANSACTION -- Sets the characteristics of the current SQL-transaction
SHOW -- Shows run-time parameters
TRUNCATE --  Empties a table
UNLISTEN --  Stops listening for a notification.
UPDATE --  Replaces values of columns in a table
VACUUM --  Cleans and analyzes a PostgreSQL database
A. SQL Key Words
Index