Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc SQL Scripts & Samples Links Database Forum DBA Videos
internet.com

» Database Journal Home
» Database News
» DBA Videos
» Database Articles
» Database Tutorials
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» DBA Jobs
» Sitemap

News Via RSS Feed



follow us on Twitter

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner


















FCC's Martin: Open Networks Becoming the Norm

Enterprise SaaS Buyers Want More Than Uptime

Cuban Waves Off SEC Allegations

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Database Journal | DBA Support | SQLCourse | SQLCourse2 | Swynk







Related Articles
Introduction to Databases for the Web: Pt 4
Introduction to Databases for the Web: Pt. 3
Introduction to Databases for the Web: Pt. 2

Developer
IT Search
US-NE-Lincoln

Justtechjobs.com Post A Job | Post A Resume

Featured Database Articles

SQL Etc

August 16, 1998

Introduction to Databases for the Web: Pt. 1

By Selena Sol

Deleting Databases and Tables

It is also simple to delete tables and databases using GUI tools or SQL. In the case of a GUI, you will simply select a table or database from your main menu and delete it as you would a file in a file system manager.

In SQL, you would simply use the DELETE or DROP commands depending on if you were deleting a whole database or just a table in a single database.

In the case of deleting a whole database, you will use the DELETE command as follows:

DELETE DATABASE DATABASE_NAME;

The following example would delete the database MY_COMPANY:

DELETE DATABASE MY_COMPANY;

In the case of a table, you use the DROP command:

DROP TABLE TABLE_NAME;

such as:

DROP TABLE EMPLOYEES;

Essentially when you use delete and drop, you are modifying the database management system's data dictionary. It shouldn't have to be said, but I will say it...BE CAREFUL WHEN DELETING OR DROPPING!

Altering a Table

Finally, you should know that it is possible to "alter" a table after it has been created using either a standard GUI tool or by using the ALTER SQL command as follows:

ALTER TABLE  TABLE_NAME
      DROP   COLUMN_NAME, COLUMN_NAME
      ADD    COLUMN_NAME DATA_TYPE, COLUMN_NAME DATA_TYPE
      RENAME COLUMN_NAME NEW NAME
      MODIFY COLUMN_NAME DATA_TYPE;

such as the following case in which we alter the table named EMPLOYEES by dropping the E_GENDER Column and adding an E_ZIP column which will accept INTEGERS and which must be filled in for every new employee added to the table, and the E_MIDDLE_INIT column which will accept a single character as a value.

ALTER TABLE EMPLOYEES 
      DROP  E_GENDER
      ADD   E_ZIP INTEGER NOT NULL, 
            E_MIDDLE_INIT CHAR (1);

Go to page: Prev  1  2  3  4  5  6  7  8  9  10  11  

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

SQL etc Archives







Latest Forum Threads
SQL etc Forum
Topic By Replies Updated
Stupid (?) Query Question barb951 2 November 19th, 02:46 PM
Survey: Remote DBA Support lcole 2 November 12th, 02:41 PM
CAn anyone give solution to this ? superuser123 0 November 12th, 09:00 AM
sql date range query help! chesty 0 November 5th, 06:33 AM








internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers