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. .
Syntax:
1
|
DROP TABLE table_name;
|
Before executing the DROP table, we first check whether the required table is available in the Database or not.
1
|
SELECT * FROM SCOREBOARD;
|

Now let’s execute SQL Drop Table statement to drop the table.
1
|
DROP TABLE SCOREBOARD;
|

Execute the above mentioned SELECT query again and check it out. An error message will display as mentioned below.
1
2
|
Msg 208, Level 16, State 1, Line 1
Invalid object name ‘SCOREBOARD’.
|
Check the below mentioned image.

SQL Drop Database:
Let’s see how to delete a database completely.
The DROP DATABASE statement is used to delete a database
Syntax:
1
|
DROP DATABASE database_name;
|
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:
1
|
TRUNCATE TABLE table_name;
|
In the next tutorial, we will learn JOINS in SQL
Check out the complete SQL Tutorial by clicking on below link:
SQL Tutorial – Complete