Tip:
Highlight text to annotate it
X
In this lecture we will Learn how to Remove or delete the existing table using SQL statement.
Using standard SQL we can create as as well as remove the database table from our existing database.
The DROP TABLE SQL statement is used to remove or delete the database table including all data rows in it.
Be careful before deleting the database table completely from your database, because the system does not ask for confirmation.
As soon as you run the "DROP TABLE" statement, the system will delete the database table and the data rows instantly, and there is no easy method to recover the lost database table.
Here is the SQL statement to delete the database table, "DROP TABLE tablename;"
Lets Learn how to Remove or delete the existing table with some practical examples.
I've logged in my MySQL database server by using my root username and password.
Select 'school' database using SQL statement, "USE school;"
and display all the tables in 'school' database by using SQL statement, "SHOW TABLES;"
The system returns all the table names stored in the selected database.
In previous lecture we created a table named 'students4'. Lets delete the table.
The SQL statement will be, "DROP TABLE students4;"
Press enter to execute the SQL statement, and we get 'Query OK, 0 rows affected' message.
If we now display all the tables again using SQL statement, "SHOW TABLES;" We can see the 'students4' is deleted successfully.