DROP TABLE Query is used to Delete or Drop a table from MySQL Database.
Syntax:
This will delete users table. But this will throw error if users table is not there.
DROP TABLE users
This will delete users table only if it exist.
DROP TABLE IF EXISTS users
Modules:
- mysql: To handle MySQL connection and Queries
npm install mysql
SQL gfg_db
Database Preview (showing tables):
👁 Image
Example 1: Delete users Table
Output:
👁 Image
Example 2: Delete users Table only if it Exists
Output:
👁 Image
👁 Image