MySQL Drop Table

MySQL Drop Table

: We must have the DROP privilege for each table.

MySQL Drop Table Syntax:

DROP [TEMPORARY] TABLE [IF EXISTS] tbl_name [, tbl_name] ... [RESTRICT | CASCADE]

1. Create employee table

CREATE TABLE EMP_NEW1 (EMPNO NUMERIC(4) NOT NULL, ENAME VARCHAR(10), JOB VARCHAR(9), MGR NUMERIC(4), HIREDATE DATETIME, SAL NUMERIC(7, 2), COMM NUMERIC(7, 2), DEPTNO NUMERIC(2));

mysql> show tables
-> ;
+——————-+
| Tables_in_company |
+——————-+
| EMP |
| EMP_NEW |
| EMP_NEW1 |
+——————-+
3 rows in set (0.00 sec)

Drop table EMP_NEW1

mysql> DROP TABLE EMP_NEW1; Query OK, 0 rows affected (0.09 sec) mysql> show tables; +-------------------+ | Tables_in_company | +-------------------+ | EMP | | EMP_NEW | +-------------------+ 2 rows in set (0.00 sec)