MySQL主要命令(3)

//修该数据, 不要忘了set
      update table_name set col_name = value where 条件
//删除数据 ,   指定条件对应的数据

delete from table_name

 //修该数据
  
update table_name set col_name = value where 条件
  
  

//删除表数据

   (1) delete from table_name [where 条件]
  
  
(2) truncate table_name;
   (删除表, 在重建一个新表)
省略 where 子句的。不过这是一个很危险的行为。
因为如果不指定 where 子句,delete 将删除表中所有的记录,而且是立即删除

如果想要删除表的所有数据,truncate语句要比 delete 语句快


原文地址:https://www.cnblogs.com/chengbao/p/5363716.html