Create a table

To create a table, specify the table name, the column names, and their types. You can enter a table line by line.

The system recognizes that the command is not terminated until it encounters the semicolon (;). An example follows.
MYDB.SCHEMA(USER)=> CREATE TABLE weather (
city            varchar(80),
temp_lo         int,           -- low temperature
temp_hi         int,           -- high temperature 
prcp                               --precipitation
real, 
date                                           --date
);
The following rules apply when you are entering data:
  • You can use white space (that is, spaces, tabs, and new lines) within SQL commands.
  • Two dashes (--) introduce comments. The system ignores whatever follows a comment, up to the end of that line.
  • The varchar(80) specifies a data type that can store arbitrary character strings up to 80 characters in length.
  • An int is the normal integer type. A real is a type for storing single precision floating-point numbers.
In addition, Netezza SQL considers the following system attributes reserved words:
  • ctid
  • oid
  • xmin
  • cmin
  • xmax
  • cmax
  • tableoid
  • rowid
  • datasliceid
  • createxid
  • deletexid.