BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

SQL – DROP Table Statement to delete the entire table

Last Updated: September 10, 2022 by Chaitanya Singh | Filed Under: SQL

The DROP TABLE statement is used for deleting an entire table. This statement deletes the table definition, data, constraints and all the info that is associated or stored in table.

Syntax:

DROP TABLE TableName;

For e.g.
Lets say we have a table named “EMPLOYEES”. This is how we can see the table definition.

SQL> DESC EMPLOYEES;
+---------+---------------+------+-----+---------+
| Field   | Type          | Null | Key | Default |
+---------+---------------+------+-----+---------+
| SSN     | CHAR(10)      | NO   | PRI |         |      
| EMP-NAME| varchar(35)   | NO   |     |         |       
| EMP_AGE | int(11)       | NO   |     |         |      
| EMP_ADDR| varchar(45)   | YES  |     | NULL    |     
+---------+---------------+------+-----+---------+
4 rows in set (0.00 sec)

Lets delete the table.

SQL> DROP TABLE EMPLOYEES;
Query OK, 0 rows affected (0.01 sec)

Lets verify whether the table dropped successfully.

SQL> DESC EMPLOYEES;
ERROR: Table 'DB1.EMPLOYEES' doesn't exist

As you can see that table has been successfully deleted from the database “DB1”.

Top Related Articles:

  1. Introduction to SQL
  2. SQL CREATE DATABASE Statement
  3. SQL SELECT Database – USE Statement
  4. SQL UPDATE Statement
  5. DEFAULT Constraint in SQL

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Comments

  1. Kalimuthu says

    June 6, 2016 at 11:25 AM

    If we have created new table i,e., Associates from an old table i.e., Employee, when we delete the parent table Employee, will it have any impact in the table Associates?

    Please help to understand.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

SQL Tutorial

  • SQL Tutorial
  • SQL Introduction
  • SQL Syntax
  • SQL Data Types

SQL Database

  • SQL CREATE DB
  • SQL DROP DB
  • SQL Rename DB
  • SQL USE DB

SQL Queries

  • SQL Select
  • SQL Select Distinct
  • SQL Select Count
  • SQL Select Top
  • SQL Where
  • SQL AND, OR & NOT
  • SQL Order By
  • SQL Insert Into
  • SQL Insert Into SELECT
  • SQL Select Random
  • SQL Alias
  • SQL NULL Check
  • SQL Update
  • SQL Delete
  • SQL MIN, MAX
  • SQL SUM
  • SQL AVG

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap