- 5 years ago
- Zaid Bin Khalid
- 2,771 Views
-
3
In this tutorial, we will learn how to delete database and table by using SQL statement.
Removing a table from Database
The SQL DROP TABLE Statement can easily and permanently delete or drop the database table which is not required anymore. Moreover, it also deletes metadata that defines the data dictionary in a table.
The SQL Drop Statement in the database or table is irreversible and data will permanently be deleted. You must be very careful while using the DROP Statement because when you are applying this statement in a database mostly it will not display any notification like “Are You Sure?” The Drop Table Removes more than one table at once.
Syntax
The DROP TABLE syntax can be given with.
DROP TABLE table1_name, table2_name, ...;
The mention below DROP TABLE statement will remove the table permanently from the database. The table name is persons as mentioned in the below command.
After executing the mention above command, if you want to try any operation on the persons table, it will display an error message.
Removing Database
Removing Database is used to delete a database from the server, if you remove the database by using the DROP DATABASE statement, This Following Command will permanently remove the demo database from the database server. You must be very careful while using the DROP Statement when you want to Remove Database.
After executing the mention above command, if you want to try to select the demo database using the use demo; statement, you’ll get an error message saying “Unknown database” or “Database does not exist”
- 5 years ago
- Zaid Bin Khalid
- 2,771 Views
-
3