Name
CREATE TABLE
Synopsis
The CREATE TABLE
statement does what it says: create a table. However, most vendors
also allow a wide variety of other functions to be exercised through
the CREATE TABLE
statement, such as the
assignment of keys, cascading referential integrity, constraints, and
default values.
Vendor |
Command |
---|---|
SQL Server |
Supported, with variations |
MySQL |
Supported, with variations |
Oracle |
Supported, with variations |
PostgreSQL |
Supported, with variations |
This command defines a table name, its constituent columns, and any properties to the columns and/or table. Typically, a great deal of consideration goes into the design and creation of a table. This discipline is known as database design . The discipline of analyzing the relationship of a table to its own data and to other tables within the database is known as normalization .
Tip
It is strongly recommended that programmers and developers study both
database design and normalization principles thoroughly before
issuing CREATE TABLE
commands.
In general, the table name always starts with an alphabetic character. The allowable length of the name varies by vendor; Oracle allows only 30 characters, but it can be much bigger than 30 characters when necessary. Numbers may be used in the name of the table, but do not use any symbol other than the underscore ( _ ). Some vendors allow many other symbols in the name of a table, but it’s good practice not to use them since they can create confusing identifiers.
When defining ...
Get SQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.