Name
CREATE/ALTER TABLE Statement
Synopsis
Manipulating tables is one of the most common activities that database administrators and programmers perform when working with database objects. This section details how to create and modify tables.
The ANSI standard represents a sort of least common denominator among the vendors, though not every option of the ANSI standard version of CREATE TABLE and ALTER TABLE is offered by each of the vendors. However, the ANSI standard does represent the basic form that can be used across all of the platforms. In turn, the vendor platforms offer a variety of extensions and additions to the ANSI standards for CREATE and ALTER TABLE.
Tip
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. We recommend that database programmers and administrators alike study both database design and normalization principles thoroughly before issuing CREATE TABLE commands.
Platform |
Command |
DB2 |
Supported, with variations |
MySQL |
Supported, with variations |
Oracle |
Supported, with variations |
PostgreSQL |
Supported, with variations |
SQL Server |
Supported, with variations |
SQL2003 Syntax
The SQL2003 statement CREATE TABLE creates a permanent or temporary table within the database where the command is issued. The syntax is as follows:
CREATE [{LOCAL TEMPORARY| ...
Get SQL in a Nutshell, 2nd Edition 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.