sql

Drop table SQL query

A drop table SQL query is a type of query used to remove a table from a database. This query is typically used when a table is no longer needed or when it needs to be replaced with a new table.

DROP TABLE table_name;

The SQL query to delete the entire table from the database along with all data rows stored in it.


Delete a table along with its data

When you delete a table, you are also deleting all of the data that is stored within that table. This can be a permanent action, so it is important to be absolutely certain that you want to delete the table and all of its data before proceeding. Here, we will show you how to delete a table along with its data in just a few simple steps.

Syntax

DROP TABLE TABLE_NAME;

Assume that you have a table in SQL called users that contains multiple rows and columns. If you want to remove this table from the database along with its data.

Code example

DROP TABLE users;

Was this helpful?