Amazon.com: PC Books || Educational Software || Magazines
Amazon: Books-CA || Software-CA || Books-UK || Software-UK

HTML | Javascript | ASP | PHP | VBScript | SQL | Hardware | PC FAQ| WinXP|

Learn to Build, Upgrade, or Repair your Computer Ebook + PC Safety 101 kwwebservice.com Reasonably priced web development & hosting
SQL Basics
Introduction
Create Tables
Data Type
Delete/Modify Table
Add Rows
Create Sequence
Quiries
Single-Row Function
Group Functions
Joints
Create Views
Books @
CA Amazon
UK Amazon
US Amazon

  :: Home
PC Topics
  :: Build A PC
  :: Windows XP
  :: PC Help
Tutorials
  :: HTML
  :: JavaScript
  :: ASP
  :: PHP
  :: VBScript
  :: SQL
Miscellaneous
  :: Code/Scripts
  :: Forum
  :: Links
  :: Contact us
  :: Tell A Friend
  :: In Somali
  ::
Web Articles
  Top Web Hosting
Reviews
  Processing
Online Card Payment Guide
  Domain name
registration & buying guide
  Getting
a website online guide
  Search Engine
submission & optimization tips
Netfirms Web Hosting
Free trial
Quality business correspondence.
Yahoo! Search Marketing

Delete or Modify SQL Table

ALTER TABLE  statement will allow you to add new column or constraint, modify existing column or constraint, and drop existing column or existing constraint after the table is created.  The following statement will add a middle name column to the employees table.
ALTER TABLE employees
     ADD COLUMN middle_name VARCHAR2(25);

 

The statement bellow modifies the last_name to required column. This statement works when there no null last name exist now.
ALTER TABLE employees
     MODIFY last_name NOT NULL;

This statement deletes the above column.
ALTER TABLE employees
     DROP COLUMN last_name;

Adding, and deleting constraints are similar to those of the column.  Here is an statement to add a foreign key to employees table.
ALTER TABLE employees
     ADD FOREIGN KEY (department_id) NUMBER REFERENCES department;

To delete a column or constraint use DROP followed by the column or constraint name in the position of ADD or MODIFY.
Constraints can be turned off temporarily instead of dropping it, by using DISABLE/ENABLE clause within the alter table statement.  The bellow statement turns off the primary key for employees table.  ENABLE is used when turning it on.
 ALTER TABLE employees DISABLE PRIMARY KEY;

Data Types Insert Rows
Listed @ ConsumerVote.com - The Consumer Rated Web Directory
PC Articles
  Computer Safety
prevent viruses & Spyware