Chapter 11. Creating, Altering, and Dropping Tables

Many DBMSs have interactive, graphical tools that let you create and manage tables and table properties such as column definitions and constraints. This chapter explains how to perform those tasks programmatically by using SQL:

  • The CREATE TABLE statement creates a new table.

  • The ALTER TABLE statement modifies the structure of an existing table.

  • The DROP TABLE statement destroys a table and all its data.

  • The CREATE TEMPORARY TABLE statement creates a table that the DBMS destroys automatically when it’s no longer in use.

  • The CREATE TABLE AS statement creates a new table from an existing one.

These statements don’t return a result, but your DBMS might print a message indicating whether the statement ran ...

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