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. SQL – DROP Table Statement to delete the entire table
  2. LIKE Clause in SQL
  3. SQL Select Random Rows from Table
  4. SQL SELECT SUM() Function
  5. SQL SELECT AS – Alias in SQL
  6. SQL SELECT Statement

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 – 2021 BeginnersBook . Privacy Policy . Sitemap