Quackit Logo

Got a MySpace Page?

Get "www.yourname.com" for your MySpace page. Learn how >>.

SQL Alter Table

Print Version

In an earlier lesson, we created a table with the CREATE TABLE command. In this lesson, we will modify the table using the ALTER TABLE command.

Add a Column

SQL syntax

ALTER TABLE table_name
ADD column_name datatype

Example SQL Statement

ALTER TABLE Individual
ADD age int

Change the Datatype

SQL syntax

ALTER TABLE table_name
ALTER COLUMN column_name datatype

Example SQL Statement

ALTER TABLE Individual
ALTER COLUMN age numeric

Drop a Column

'Dropping' a column means removing or deleting that column.

SQL syntax

ALTER TABLE table_name
DROP COLUMN column_name

Example SQL Statement


ALTER TABLE Individual
DROP COLUMN age

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
                     
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!