Prev Next
1. SQL – DROP TABLE:
- An existing SQL – DROP TABLE can be dropped/deleted using “DROP TABLE” statement.
- But, before dropping any parent table, its child table also should have been already dropped. Unless, parent table can’t be dropped due to its integrity.
Syntax For SQL – DROP TABLE:
DROP TABLE table_name; |
Example For SQL DROP TABLE:
DROP TABLE student; |
2. SQL – TRUNCATE TABLE:
If you want only to drop all records in a table and don’t want to delete the table, then you can use TRUNCATE statement. In this case, this table will exist and be empty
Syntax For SQL – TRUNCATE TABLE:
TRUNCATE TABLE table_name; |
Example For SQL TRUNCATE TABLE:
TRUNCATE TABLE student; |
3. SQL – DROP DATABASE:
An existing SQL database can be deleted using DROP DATABASE statement.
Syntax SQL – DROP DATABASE:
DROP DATABASE database_name; |
Example SQL DROP DATABASE:
DROP DATABASE STUDENT_DB; |