DROP TABLE

The DROP TABLE statement removes a table and all its contents from the database. After you remove a table, the data it contains is gone forever; therefore, you should be careful with this command.

The database will not let you drop a table that is the master table in a relational constraint. For instance, consider the following SQL script. In this example, the EmployeeId field in the Departments table refers to the EmployeeId field in the Employees table. The database will not let you drop the Employees table even if there are no records in either table:

 CREATE TABLE Employees ( EmployeeId NUMERIC UNIQUE NOT NULL ); CREATE TABLE Departments ( DepartmentId NUMERIC NOT NULL, EmployeeId NUMERIC REFERENCES Employees(EmployeeId) ); DROP ...

Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.