What is MySQL DROP command used for?



As the name explains, it is used to completely remove the table from the database.

Syntax

Drop table table_name;

Example

mysql> Drop table Student;
Query OK, 0 rows affected (0.09 sec)

The query above completely removes the ‘Student’ table from the database. We can observe as MySQL returns an error message after running the following query −

mysql> Select * from Student;
ERROR 1146 (42S02): Table 'query.student' doesn't exist
Sharon Christine
Sharon Christine

An investment in knowledge pays the best interest


Advertisements