Creating a New Table with CREATE TABLE

In this section, I’ll show you how to create a new table by using a minimal CREATE TABLE statement. In subsequent sections, I’ll show you how to add column and table constraints to CREATE TABLE.

To create a new table:

  • Type:
    CREATE TABLE table
      (
      column1 data_type1,
    								column2 data_type2,
      ...
      columnN data_typeN
      );
    
    table is the name of the new table to create. column1, column2,..., columnN are the names of the columns in table. You must create at least one column. data_type1, data_type2,..., data_typeN specify the SQL data type of each corresponding column. A data type may contain a length, scale, or precision specification, where applicable; see “Data Types” and subsequent sections in Chapter 3. The table ...

Get SQL: Visual QuickStart Guide 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.