Name
DROP
Synopsis
DROP DATABASEnameDROP INDEXnameDROP TABLE [IF EXISTS]name[,name2, ...] DROP FUNCTIONname
Permanently remove a database, table, index, or function from the MySQL system.
DROP DATABASEWill remove an entire database with all of its associated files. The number of files deleted will be returned to the user. Because three files represent most tables, the number returned is usually the number of tables times three. This is equivalent to running the
mysqladmin droputility. As with runningmysqladmin, you must be the administrative user for MySQL (usually root or mysql) to perform this statement.DROP INDEXStatement provides for compatibility with other SQL implementations. In older versions of MySQL, this statement does nothing. As of 3.22, this statement is equivalent to
ALTER TABLE. . .DROP INDEX. To perform theDROP INDEXstatement, you must haveSELECT,INSERT,DELETE,UPDATE,CREATEandDROPprivileges for the table in question.DROP TABLEWill erase an entire table permanently. In the current implementation, MySQL simply deletes the files associated with the table. As of 3.22, you may specify
IF EXISTSto make MySQL not return an error if you attempt to remove a table that does not exist. You must haveDELETEprivileges on the table to use this statement.DROP FUNCTIONWill remove a user defined function from the running MySQL server process. This does not actually delete the library file containing the function. You may add the function again at any time ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access