MySQL

MySQL IntroductionComment MySQLInstall MySQL container with Docker-ComposeMySQL AdminMySQL ALTER TABLEMySQL ArithmeticMySQL BackticksMySQL Backup using mysqldumpMySQL Change PasswordMySQL Character Sets and CollationsMySQL clientMySQL ClusteringMySQL Configuration and tuningMySQL Connecting with UTF-8 Using Various Programming language.MySQL Converting from MyISAM to InnoDBMySQL Create New UserMySQL Creating databasesMySQL Customize PS1MySQL Data TypesMySQL Date and Time OperationsMySQL Dealing with sparse or missing dataMySQL DELETEMySQL Drop TableMySQL Dynamic Un-Pivot Table using Prepared StatementMySQL ENUMMySQL Error 1055: ONLY FULL GROUP BY: something is not in GROUP by clause ...MySQL Error codesMySQL EventsMySQL Extract values from JSON typeMySQL Full-Text searchMySQL Group byMySQL Handling Time ZonesMySQL Indexes and KeysMySQL INSERTMySQL JoinsMySQL JOINS: Join 3 table with the same name of id.MySQL JSONMySQL Limit and OffsetMySQL LOAD DATA INFILEMySQL LOCK TABLEMySQL Log filesMySQL Many-to-many Mapping tableMySQL MyISAM EngineMySQL mysqlimportMySQL NULLMySQL One to ManyMySQL ORDER byMySQL PartitioningMySQL Performance TipsMySQL Performance TuningMySQL Pivot queriesMySQL PREPARE StatementsMySQL Recover from lost root passwordMySQL Regular ExpressionsMySQL ReplicationMySQL Reserved WordsMySQL Security via GRANTsMySQL SELECTMySQL Server InformationMySQL SSL Connection SetupMySQL Stored routines (procedures and functions)MySQL String operationsMySQL Table CreationMySQL Temporary TablesMySQL Time with subsecond precisionMySQL TransactionMySQL TRIGGERSMySQL UNIONMySQL UnionsMySQL UPDATEMySQL Using VariablesMySQL VIEWRecover and reset the default root password for MySQL 5.7+



MySQL Drop Table

From WikiOD

Syntax[edit | edit source]

  • DROP TABLE table_name;
  • DROP TABLE IF EXISTS table_name; -- to avoid pesky error in automated script
  • DROP TABLE t1, t2, t3; -- DROP multiple tables
  • DROP TEMPORARY TABLE t; -- DROP a table from CREATE TEMPORARY TABLE ...

Parameters[edit | edit source]

Parameters Details
TEMPORARY Optional. It specifies that only temporary tables should be dropped by the DROP TABLE statement.
IF EXISTS Optional. If specified, the DROP TABLE statement will not raise an error if one of the tables does not exist.

Drop Table[edit | edit source]

Drop Table is used to delete the table from database.

Creating Table:

Creating a table named tbl and then deleting the created table

CREATE TABLE tbl(
    id INT NOT NULL AUTO_INCREMENT,
    title VARCHAR(100) NOT NULL,
    author VARCHAR(40) NOT NULL,
    submission_date DATE,
    PRIMARY KEY (id)
);

Dropping Table:

DROP TABLE tbl;

PLEASE NOTE

Dropping table will completely delete the table from the database and all its information, and it will not be recovered.

Drop tables from database[edit | edit source]

DROP TABLE Database.table_name

Credit:Stack_Overflow_Documentation