CREATE TABLE

CREATE TABLE statement is used to create a table in an existing database.

Syntax CREATE TABLE

CREATE TABLE nametable { namecolumn1 datetype1, namecolumn2 datetype2, namecolumn3 datetype3, .... }

Example CREATE TABLE

CREATE TABLE people { name varchar (255), surname varchar (255), nickname varchar (255), int dep }

This statement will create the database 'people' with 4 columns.

The columns 'name', 'surname' and 'nickname' are of type 'varchar', ie accept alphanumeric values up to a maximum length of 255 characters.

The column 'dep' is of type 'int', ie, accepts only numbers.

There are different types of data, some are the same in all databases (MySQL, Oracle, DB2, ..) and others may be specific to only be used in any of these databases.