Table creation syntax - Creating a new table in an existing database

Once you are connected to a database, you can create new tables using the CREATE TABLE syntax.

The syntax is:

CREATE TABLE table
(
[  column_name data_type column_constraints  [, ...] ]
);
where data_type is one of
{ tinyint | smallint | int | bigint | real | float | varchar(n) | date | datetime | bool }
and column_constraints is
[ NOT NULL |  NULL | DEFAULT default_expr [, ...] ]

Example:

CREATE TABLE foo 
(
   x int not null,
   y date not null,
   ts datetime not null,
   ratio real default 1.0 not null,
   comment varchar(32) null
);

   

If you have any question how to create a new table, please contact SQream support 

  • 34
  • 20-Jul-2015
  • 351 Views