Deleting Tables and Databases

0
6

Deleting Tables and Databases To delete a table entirely, use the DROP TABLE statement. Similarly, you can delete an entire database with DROP DATABASE .

Here, we will show you how to DROP TABLE

mysql > SHOW TABLES;

Output

Tables_in_mydatabase
Courses

1 row in set 

mysql > DROP TABLE Course;

Query OK, 0 rows affected

mysql > SHOW TABLES;

Empty set

DROP DATABASE works in a similar way

mysql > SHOW DATABASES;

Output

Database
information_schema
mydatabase
mysql

3 rows in set

mysql > DROP DATABASE mydatabase;

Query OK, 0 rows affected

mysql > SHOW DATABASES;

Output

Database
information_schema
mysql

2 rows in set