O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required