How to Delete Table from MySQL Database
Notes:
How to delete a table from any MySQL database:
- To delete a table from any MySQL database; we take help of drop table command
Basic Syntax:
drop table [ if exists ] tablename;
Ex:
drop table tbl_student;
OR
drop table if exists tbl_student;
Note:
- While deleting a table; if you do not specify if exists clause & the table that you want to delete already does not exists in the database then error is thrown.
- While deleting a table; if you don’t know whether the table that you want to delete already exists in the database or not then you must specify if exists clause.
- While deleting a table; if you know that the table that you want to delete does already exist in the database then you need not to specify if exists clause.
Interview Questions: