SQL – DROP TABLE & DATABASE

Prev     Next

1. SQL – DROP TABLE:

  • An existing SQL 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:

DROP TABLE table_name;

Example:

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:

TRUNCATE TABLE table_name;

Example:

TRUNCATE TABLE student;

3. SQL – DROP DATABASE:

An existing SQL database can be deleted using DROP DATABASE statement.

Syntax:

DROP DATABASE database_name;

Example:

DROP DATABASE STUDENT_DB;

Prev     Next

1. Online Compilers - Compile & Run your C/C++ programs:

✅ Online Compilers

2. Ask your questions or clarify your/others doubts from,

✅ Online Discussion Forums by Fresh2Refresh.com





Share this website !!!
Facebook Twitter Linkedin

Close
We Support JALLIKATTU !!!
We Support JALLIKATTU!
By Fresh2Refresh.com
Show Your Support as well. Thanks!