Deleting Tables and Databases


There comes a time when you are finished with a database or a number of tables and you wish to remove them from your system, either to free up the space or to prevent data from lingering on. In SQL, these tasks are performed with the DROP DATABASE and DROP TABLE queries. Both take as their argument the name of the entity (table or database) to delete:

 DROP DATABASE DatabaseName; DROP TABLE TableName; 

Once the table is deleted, it is highly likely that it is gone forever. While some databases have high availability features and can recover from accidental invocations of this query if set up properly (Oracle is a notable example), many do not have these features. Users of graphical tools should pay particular attentionit is easy to accidentally click on the wrong button, and if it happens to be one called "Drop," you might find yourself dropped from your place of employment. This is a convincing argument for maintaining backups of your data at all times. This is also the main reason why we do not give our usual database user accounts permission to execute the DROP query. (Some call this "protecting us from ourselves.")




Core Web Application Development With PHP And MYSQL
Core Web Application Development with PHP and MySQL
ISBN: 0131867164
EAN: 2147483647
Year: 2005
Pages: 255

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net