Tutorialsteacher

Follow Us

Articles
  • C#
  • C# OOP
  • ASP.NET Core
  • ASP.NET MVC
  • LINQ
  • Inversion of Control (IoC)
  • Web API
  • JavaScript
  • TypeScript
  • jQuery
  • Angular 11
  • Node.js
  • D3.js
  • Sass
  • Python
  • Go lang
  • HTTPS (SSL)
  • Regex
  • SQL
  • SQL Server
  • PostgreSQL
  • MongoDB
  • SQL - Getting Started
  • What is SQL
  • Create Table
  • ALTER TABLE Statements
  • Rename Columns
  • Modify Column Type
  • Drop Columns
  • Rename Tables
  • Drop Tables
  • Insert Statement
  • Update Statement
  • Delete Statement
  • Truncate Statement
  • Merge Statement
  • Null Value
  • Select Query
  • WHERE Clause
  • GROUP BY Clause
  • HAVING Clause
  • ORDER BY Clause
  • SQL - Inner Join
  • SQL - Left Join
  • SQL - Right Join
  • SQL - Full Join
  • SQL - BETWEEN
  • SQL - IN
  • SQL - LIKE
  • SQL - INTERSECT
  • SQL - MINUS
  • SQL - UNION
  • SQL - UNION ALL
  • SQL - DISTINCT
  • SQL - ANY, SOME
  • SQL - ALL
  • SQL - AVG()
  • SQL - COUNT()
  • SQL - MAX()
  • SQL - MIN()
  • SQL - SUM()
Entity Framework Extensions - Boost EF Core 9
  Bulk Insert
  Bulk Delete
  Bulk Update
  Bulk Merge

SQL - DROP TABLE Statement

Use the DROP TABLE statement to delete a table with data from the database.

Syntax:

DROP TABLE table_name

The following command will delete the Employee table in the SQL Server, Oracle, SQLite, PostgreSQL, MySQL database.

SQL Script: Delete a Table
DROP TABLE Employee;

DROP Table with Cascade Constraints in Oracle

If the Employee table has some primary key, which is referred in other child tables, then first we have to drop referential constraints from the child table and then you can drop the parent table.

To drop the parent table along with the referential integrity constraint, you can use the DROP TABLE command with CASCADE CONSTRAINTS in Oracle, as shown below.

SQL Script: Cascade Constraints in Oracle
DROP TABLE Employee CASCADE CONSTRAINTS;

DROP Table with Purge Option in Oracle

If we use DROP TABLE without the PURGE option, it moves the table and its dependent objects to recycle bin, and the space occupied by them will not be freed. If we specify the PURGE option while dropping a table, it will a drop table along with its dependent objects and free the space.

SQL Script: Purge in Oracle
DROP TABLE Employee PURGE;
TUTORIALSTEACHER.COM

TutorialsTeacher.com is your authoritative source for comprehensive technologies tutorials, tailored to guide you through mastering various web and other technologies through a step-by-step approach.

Our content helps you to learn technologies easily and quickly for learners of all levels. By accessing this platform, you acknowledge that you have reviewed and consented to abide by our Terms of Use and Privacy Policy, designed to safeguard your experience and privacy rights.

[email protected]

ABOUT USTERMS OF USEPRIVACY POLICY
copywrite-symbol

2024 TutorialsTeacher.com. (v 1.2) All Rights Reserved.