SQL Drop – SQL TUTORIAL | Software Testing Material

SQL Drop Table:

The SQL DROP TABLE statement is used to delete a table definition and all data, indexes, triggers, constraints, and permission specifications for that table.

NOTE: Once a table is deleted then all the information in the table would be lost forever. Please be careful while using this statement. .


Before executing the DROP table, we first check whether the required table is available in the Database or not.

SQL Select Query

Now let’s execute SQL Drop Table statement to drop the table.

SQL Drop Query

Execute the above mentioned SELECT query again and check it out. An error message will display as mentioned below.

Check the below mentioned image.

SQL Drop

SQL Drop Database:

Let’s see how to delete a database completely.

The DROP DATABASE statement is used to delete a database


Let’s see how to truncate data from a table:

if we only want to delete the data inside the table, and not the table itself?

Then, use the TRUNCATE TABLE statement:

In the next tutorial, we will learn JOINS in SQL

Check out the complete SQL Tutorial by clicking on below link:

SQL Drop

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap