We provide IT Services

Register Now Click On

Read More Tutorials Click On

Post Page Advertisement [Top]


Difference between delete and truncate in sql

create table tblstudents
(
std_id int,   
stdname varchar(30), 
age  tinyint,
gender char
)

query 2:  how to insert data into above table

insert tblstudents (std_id, stdname, age, gender)  values (1001, 'jeff',21, 'm')

insert tblstudents (std_id, stdname, age)  values (1002, 'john',null)


Delete  : To remove data from table.      
        
  Query:            delete from tblstudents



Truncate : to remove data from table. this is not logged by log file. 


Query:              Truncate table tblstudents



Drop    : To remove structure of table. 

Query:  drop table tblstudents



No comments:

Post a comment

| Designed by Rockprogrammer