TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

SQL DROP Table

SQL drop table query with sql, tutorial, examples, insert, update, delete, select, join, database, table, join

<< Back to SQL

SQL DROP TABLE

A SQL DROP TABLE statement is used to delete a table definition and all data from a table.

This is very important to know that once a table is deleted all the information available in the table is lost forever, so we have to be very careful when using this command.

Let's see the syntax to drop the table from the database.

DROP TABLE "table_name";

Let us take an example:

First we verify STUDENTS table and then we would delete it from the database.

SQL> DESC STUDENTS;
FIELDTYPENULLKEYDEFAULTEXTRA
IDInt(11)NOPRI
NAMEVarchar(20)NO
AGEInt(11)NO
ADDRESSVarchar(25)YESNULL
4 rows in set (0.00 sec)

This shows that STUDENTS table is available in the database, so we can drop it as follows:

SQL>DROP TABLE STUDENTS;

Now, use the following command to check whether table exists or not.

SQL> DESC STUDENTS;
Query OK, 0 rows affected (0.01 sec)

As you can see, table is dropped so it doesn't display it.


SQL DROP TABLE Example in MySQL

Let's see the command to drop a table from the MySQL database.

DROP TABLE table_name;

SQL DROP TABLE Example in Oracle

Let's see the command to drop a table from Oracle database. It is same as MySQL.

DROP TABLE table_name;

SQL DROP TABLE Example in Microsoft SQLServer

Let's see the command to drop a table from SQLServer database. It is same as MySQL.

DROP TABLE table_name;
Next TopicSQL DELETE TABLE




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf