beginnersbook.com

  • Home
  • All Tutorials
    • Learn Servlet
    • Learn JSP
    • Learn JSTL
    • Learn C
    • Learn C++
    • Learn MongoDB
    • Learn XML
    • Learn Python
    • Learn Perl
    • Learn Kotlin
  • Core Java
  • OOPs
  • Collections
  • Java I/O
  • JSON
  • DBMS

SQL – DROP DATABASE statement

By Chaitanya Singh | Filed Under: SQL

The DROP DATABASE statement is used for deleting a database and all of its tables completely.

Syntax:

DROP DATABASE DBName;

Here DBName is the name of the database which you want to delete.

Example – The below statement would delete the database named “Student”.

SQL> DROP DATABASE Student;

Note: By deleting a database you delete all of its tables implicitly. For e.g. the above statement would delete all the tables that are stored inside “Student” database, along with the database.

After dropping a database you can check the database list to cross verify that the database has been successfully dropped or not. This is how you can do it.

Before deleting “Student” Database:

SQL> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| Abc                |
| Xyz                |
| Student            |
| Demo               |
| Test               |
+--------------------+
5 rows in set (0.00 sec)

After deleting “Student” Database:

SQL> DROP DATABASE Student;

List down the databases:

SQL> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| Abc                |
| Xyz                |
| Demo               |
| Test               |
+--------------------+
4 rows in set (0.00 sec)

Enjoyed this post? Try these related posts

  1. LIKE Clause in SQL
  2. SQL SELECT SUM() Function
  3. SQL SELECT MIN, MAX Functions
  4. DEFAULT Constraint in SQL
  5. SQL ORDER BY Clause
  6. SQL AND, OR and NOT Operators with examples

Leave a Reply Cancel reply

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

SQL Tutorial

  • SQL Introduction
  • SQL Syntax
  • 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

Recently Added..

  • JSON Tutorial
  • Java Regular Expressions Tutorial
  • Java Enum Tutorial
  • Java Annotations Tutorial

Copyright © 2012 – 2019 BeginnersBook . Privacy Policy . Sitemap