Dropping Tables with Raw SQL
The raw SQL command DROP TABLE drops tables from a database. An alternative is to use the Mathematica
, 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
A simple table is created and two rows are inserted.
An SQL statement that drops the TEST
table is executed.
This confirms that the TEST
table is no longer in the database.
This closes the connection.
It should be noted that it is not permitted to drop a table that is referenced by another.