Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

SQL Drop Table Statement

  • Last Updated : 27 Sep, 2021

SQL is a programming language used to manipulate data that are stored in the database. It is flexible and user-friendly. In SQL, to interact with the database, the users have to type queries that have certain syntax, e.g., the drop command. The drop command in SQL is used to remove the whole table including data present inside it, indexes, triggers, constraints, and permission specifications for that particular table. It is basically a DDL(data definition language) which is irreversible in nature. It means that once the user drops a table, there is no way to undo the command. Therefore, the drop command must be used with extensive care. It can also delete a whole database or can simply delete a table, it depends on the wish of the user.


To drop table:

DROP TABLE table_name;

To drop database:

DROP DATABASE database_name;

Example 1: Drop the table

In this example, we will discuss how to drop a table named “categories” from a database named “Newcafe”.

Step 1: Create a database


Step 2: Use a database

USE Newcafe;

Step 3: Create a table

CREATE TABLE [dbo].[categories]
    [CategoryName] NVARCHAR(50) NOT NULL,
    [ItemDescription] NVARCHAR(50) NOT NULL

Add data inside a table

INSERT INTO [dbo].[categories]
    [CategoryID], [CategoryName], [ItemDescription]
    1, 'Beverages', 'SoftDrink'
    2, 'Condiments', 'Sweet and Savoury sauces'
    3, 'Confections', 'Sweet bread'

View the final table:

SELECT * FROM  categories;

Step 4: Drop the categories table

drop table categories;

Example 2: Drop the database

Now we drop the above create the database using the following command:

drop database Newcafe;

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!