Book Contents

Book Index

Next Topic

Home

CREATE TABLE

Creates a table in the logical schema.

CREATE TABLE does not create a projection corresponding to the table. Every column in the table must exist in at least one projection before you can store data in the table.

Syntax

CREATE TABLE table_name ( column-definition [ , ... ] )

Semantics

table-name

specifies the name of the table to be created

column-definition

defines one or more columns. See column-definition

Notes

Examples

CREATE TABLE Product_Dimension (

Product_Key integer NOT NULL,

Product_Description varchar(128),

SKU_Number char(32) NOT NULL,

Category_Description char(32),

Department_Description char(32) NOT NULL,

Package_Type_Description char(32),

Package_Size char(32),

Fat_Content integer,

Diet_Type char(32),

Weight integer,

Weight_Units_of_Measure char(32),

Shelf_Width integer,

Shelf_Height integer,

Shelf_Depth integer

);

SQL Language References

PostgreSQL 8.0.12 Documentation

BNF Grammar for SQL-99

In This Section

column-definition

column-constraint