SQLRef
Tutorials and examples for common SQL commands.
Check out my new SQL Server to PostgreSQL Migration tool, Albatross!
Querying data (DQL)
The Basics
Joins
Aggregations
Date Functions
Utilities
Defining data structures (DDL)
DDL is used to define the structure of data.
Create
CREATE TABLECREATE INDEXCREATE SCHEMACREATE TABLECREATE DATABASECREATE USERCREATE VIEWCREATE TABLE AS SELECT
Alter
ADD COLUMNChange Column DatatypeDROP COLUMNRENAME COLUMNRENAME DATABASERENAME INDEXRENAME SCHEMARENAME TABLERENAME USERChange User PasswordRENAME VIEW
Drop
DML
DML is used to alter data.
Insert
Update
Delete
Sample schema
Most of our examples use the same schema. You can view that schema here