In this recipe, you will learn how to create, change, and delete tables and other logical database constructs that compose a database schema.
The standard SQL statement for table creation looks as follows:
CREATE TABLE table_name ( column1_name data_type(size), column2_name data_type(size), column3_name data_type(size), .... );
Here, table_name
and column_name
have to be alphanumeric and unique (inside the schema) identifiers. The limitations for the names and possible data types are database-specific. For example, Oracle allows the table name to have 128 characters, while in PostgreSQL, the maximum length of the table name and column name is 63 characters. There are differences in the data types too, so read the database documentation.