April 2002
Intermediate to advanced
416 pages
11h 50m
English
The ALTER TABLE statement lets you redefine a table’s structure. It lets you add or delete columns and constraints. The syntax is similar to the syntax used to define parts of a table except this statement begins with ALTER TABLE. For example, the following script creates a Salary table. Successive ALTER TABLE statements then add additional fields and constraints and drop the original EmployeeName field:
# Create the Salary table. CREATE TABLE Salary ( EmployeeName VARCHAR(100) NOT NULL ); # Add the FirstName field with a NOT NULL constraint. ALTER TABLE Salary ADD FirstName VARCHAR(50) NOT NULL DEFAULT ''; # Add the LastName field with a NOT NULL constraint. ALTER TABLE Salary ADD LastName VARCHAR(50) NOT NULL DEFAULT ''; # Drop ...
Read now
Unlock full access