This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
DatabaseLink Tutorial

Dropping Tables with Raw SQL

The raw SQL command DROP TABLE drops tables from a database. An alternative is to use the Mathematica command SQLDropTable, described in "Dropping Tables".
If you find that the examples in this tutorial do not work as shown, you may need to install or restore the example database with the DatabaseExamples` package, as described in "Using the Example Databases".
When dropping a table, the result of SQLExecute will be $Failed if there is an error.
Here is an example that drops a table. This loads DatabaseLink and connects to the demo database.
Click for copyable input
A simple table is created and two rows are inserted.
Click for copyable input
An SQL statement that drops the TEST table is executed.
Click for copyable input
This confirms that the TEST table is no longer in the database.
Click for copyable input
This closes the connection.
Click for copyable input
It should be noted that it is not permitted to drop a table that is referenced by another.