Code has been added to clipboard!

Learn Using SQL DROP TABLE and DROP DATABASE Functions

Reading time 1 min
Published Aug 9, 2017
Updated Oct 9, 2019

TL;DR – You can remove a database, a table or an index easily by using the DROP command.

The syntax for SQL DROP

In MS Access

Example
DROP INDEX indx_name ON tbl_name

In MS SQL Server

Example
DROP INDEX tbl_name.indx_name

In DB2/Oracle

Example
DROP INDEX indx_name

In MySQL

Example
ALTER TABLE tbl_name DROP INDEX indx_name

SQL DROP TABLE

Example
DROP TABLE tbl_name

SQL DROP DATABASE

Example
DROP DATABASE db_name

Removing the data from the table

Example
TRUNCATE TABLE tbl_name

In SQLite

Example
DELETE FROM customers;
Learn SQL
Introduction
Syntax
Data Types
Server Data Types
Commands
Commands List
Wildcards
Constraints
Aggregate Functions
Date Functions
Date Format
Injection
SQL Server Hosting
Views
Auto-incrementation
SQL Operators
AS
AND & OR
IN
BETWEEN
WHERE
GROUP BY
HAVING
ORDER BY
LIKE
NOT
NOT EQUAL
UNION
NULL
NOT NULL
DEFAULT
UNIQUE
FOREIGN KEY
PRIMARY KEY
CHECK
Indexes
ALTER TABLE
CREATE DATABASE
CREATE TABLE
DELETE
DROP
INSERT INTO SELECT
INSERT INTO
SELECT
SELECT DISTINCT
SELECT INTO
SELECT TOP
UPDATE
FULL OUTER JOIN
INNER JOIN
JOIN
LEFT JOIN
RIGHT JOIN
AVG()
COUNT
FIRST
LAST
MAX
MIN()
SUM()
LEN
UCASE
MID
NOW
ROUND
FORMAT
LOWER
CONVERT
ISNULL