CREATE TABLE

4D - Documentation   Français   English   German   4D SQL Reference, Table of Contents   4D SQL Reference, Index   Back   Previous   Next

version 11


CREATE TABLE [IF NOT EXISTS] sql_name({column_definition |table_constraint}, ... , {column_definition |table_constraint})

Description

The CREATE TABLE command is used to create a table named sql_name having the fields specified by passing one or more column_definition and/or table_constraint type arguments. If the IF NOT EXISTS constraint is passed, the table is only created when there is no table with the same name already in the database. Otherwise, it is not created and no error is generated.

A column_definition contains the name (sql_name) and data type (sql_data_type_name) of a column and a table_constraint restricts the values that a table can store.

Examples

1. Here is a simple example for creating a table with two columns:

   CREATE TABLE ACTOR_FANS       
   (ID INT32, Name VARCHAR);

2. This example creates the same table but only if there is no existing table with the same name:


   CREATE TABLE IF NOT EXISTS ACTOR_FANS       
   (ID INT32, Name VARCHAR);

See Also

ALTER TABLE, column_definition, DROP TABLE, table_constraint.


4D - Documentation   Français   English   German   4D SQL Reference, Table of Contents   4D SQL Reference, Index   Back   Previous   Next