How can I drop the database in MySQL only if it exists?
I found a solution:
We can use the following syntax so we won't get errors while trying to drop a database that doesn't exist:
DROP DATABASE IF EXISTS `database_name`;
Check the article below to see some practical examples: