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

DBMS: SQL Drop Table

By Chaitanya Singh | Filed Under: DBMS

DROP TABLE statement is used to delete the existing table from the database. There is another statement TRUNCATE TABLE which is also used to delete the entire table. The difference between these two statements is that TRUNCATE TABLE deletes all the rows from the table but table still exists in the database, however the DROP TABLE statement deletes the table definition along with the data. That means table doesn’t exist in the database anymore after it is been dropped using DROP TABLE statement.

Syntax:

DROP TABLE table_name;

Example: Let’s consider the same table that we have created in the CREATE TABLE tutorial.
Let’s check the existence of the table in the database first by using DESC statement:

DESC STUDENT;

This will show the table definition, which will confirm that the table STUDENT in present in the database. We can now drop this table using DROP TABLE statement.

DROP TABLE;

The above statement deleted the entire table from database, let’s check again using DESC command.

Query OK, 0 rows affected (0.01 sec)

This confirms that the table is deleted successfully from the database.

TRUNCATE TABLE:

We have learned above how to delete the existence of a table from database, however if you want table to exist in database but want to delete all its data (all the rows) then you can use TRUNCATE TABLE statement.

TRUNCATE TABLE table_name;
❮ SQL CREATESQL SELECT ❯

Leave a Reply Cancel reply

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

DBMS Tutorial

Basics

  • DBMS Tutorial
  • DBMS Introduction
  • Database Applications
  • DBMS vs File System
  • DBMS vs RDBMS
  • DBMS Architecture
  • Three-level DBMS architecture
  • View in DBMS
  • Abstraction
  • Instance & Schema
  • DBMS languages

Data Models

  • Data Models
  • ER Diagram
  • ER Design issues
  • Convert ER to table
  • DBMS Generalization
  • DBMS Specialization
  • DBMS Aggregration
  • Relational Model
  • Hierarchical Model
  • Constraints
  • Cardinality

Relational Database

  • RDBMS concepts
  • Relational Algebra
  • Relational Calculus
  • Keys Index
  • Primary Key
  • Super Key
  • Candidate Key
  • Foreign Key
  • Composite Key
  • Alternate Key

Normalization

  • Normalization
  • Functional dependency

Transaction Management

  • Transaction Management
  • ACID properties
  • Transaction States
  • DBMS Schedules
  • Serializability
  • Conflict Serializability
  • View Serializability
  • Recoverability Of Schedule
  • Failure Classification
  • Log based Recovery
  • DBMS Checkpoint
  • Deadlock

Concurrency Control

  • Concurrency Control
  • Lock based protocol
  • Timestamp based protocol
  • Validation based protocol

File Organization

  • File Organization
  • Sequential File Organization
  • Heap File Organization
  • Hash File Organization
  • DBMS ISAM
  • B+ File Organization
  • Cluster File Organization

SQL Introduction

  • SQL Introduction
  • SQL Characteristics
  • Advantages of SQL
  • SQL Commands
  • SQL Operators
  • SQL CREATE
  • SQL DROP
  • SQL SELECT
  • SQL INSERT

Copyright © 2012 – 2022 BeginnersBook . Privacy Policy . Sitemap