TRUNCATE TABLE and DROP TABLE Commands in SQL
In this class, we will understand TRUNCATE TABLE and DROP TABLE Commands in SQL.
We have already discussed the concepts of alter table.
TRUNCATE TABLE and DROP TABLE Commands in SQL
To understand, we will use the user’s table as shown below.
In the above table, we have two rows.
TRUNCATE TABLE Command
The TRUNCATE TABLE statement deletes the data inside a table, but not the table itself.
If we want to delete all the rows in the table, we have to use the truncate command.
With the truncate, we can delete all the rows in the table, but not the table itself.
The syntax for truncate is as shown below.
TRUNCATE TABLE table_name;
Now, we will truncate the user’s table.
TRUNCATE TABLE users;
We will check whether the rows have been deleted or not by using the select command.
The table has been truncated.
DROP TABLE Command
The DROP TABLE statement is used to drop an existing table in a database.
To delete the structure of the table, we use the drop command.
The syntax to drop a table is as shown below.
DROP TABLE table_name;
DROP TABLE users;
The user’s table no more exists.
Let us check with the select command.
#learningmonkey #dbms #placements #gatecse #gatedbms #campusplacements
Link for playlists:
/ @learningmonkey
Link for our website: https://learningmonkey.in
Follow us on Facebook @ / learningmonkey
Follow us on Instagram @ / learningmonkey1
Follow us on Twitter @ / _learningmonkey
Mail us @ [email protected]
On this page of the site you can watch the video online TRUNCATE TABLE & DROP TABLE Commands in SQL || Lesson 43 || DBMS || Learning Monkey || with a duration of hours minute second in good quality, which was uploaded by the user Learning Monkey 25 October 2021, share the link with friends and acquaintances, this video has already been watched 1,430 times on youtube and it was liked by 24 viewers. Enjoy your viewing!