Friday, December 18, 2009

ALTER TABLE Statement

ALTER TABLE Statement :
  • Use the ALTER TABLE statement to :
    – Add a new column
    – Modify an existing column
    – Define a default value for the new column
    – Drop a column
Dropping a Table :
  • All data and structure in the table are deleted.
  • Any pending transactions are committed.
  • All indexes are dropped.
  • All constraints are dropped.
  • You cannot roll back the DROP TABLE statement.
  • DROP TABLE dept30;

Creating a Table by Using a Subquery

Creating a Table by Using a Subquery :
  • Create a table and insert rows by combining the CREATE TABLE statement and the AS subquery option.
  • Match the numeric of specified columns to the numeric of subquery columns.
  • Define columns with column names and default values.
  • CREATE TABLE table [(column, column...)] AS subquery;

Followers