Deletes the table
notes
if exists. It will not occur an error if it does not exist, because we are using
IF EXISTS
keyword
DROP TABLE IF EXISTS notes
The same goes when creating a new table. It will not cause an error if a table with the same name already exists. If the table does not exist, it will create one with the specified fields:
CREATE TABLE IF NOT EXISTS students  (
  `id` int(11) NOT NULL,
  `first_name` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL
) ENGINE=InnoDB;
by Valeri Tandilashvili
4 years ago
MySQL
IF EXISTS
Full MySQL Course for Beginners
1
Pro tip: use ```triple backticks around text``` to write in code fences