The SQL TRUNCATE TABLE command is used to delete complete data from an existing table. You can also use DROP TABLE command to delete complete table but it would remove complete table structure form the database and you would need to re-create this table once again if you wish you store some data.
The basic syntax is as follows:
TRUNCATE TABLE table_name |
Employee | ||||
Emp_id | Name | Surname | Salary | Dept_id |
1 | Rajesh | Khanna | 45000 | 2 |
2 | Sneha | Gupta | 55000 | 4 |
3 | Sandeep | Nehte | 95000 | 1 |
4 | Kirti | Patil | 25000 | 3 |
5 | Nilesh | Jadhav | 45000 | 3 |
6 | Dipesh | Das | 35000 | 5 |
7 | Kailash | Rane | 62000 | 1 |
8 | Kavita | Deshpande | 48000 | 3 |
9 | Sanjay | Datt | 50000 | 3 |
10 | Shruti | Hasan | 78000 | 1 |
Syntax For SQL:
TRUNCATE TABLE employee |
After Execute:
Empty set (0.00 sec) |
No comments:
Post a Comment