必須會的SQL語句(四)刪除和更新1.刪除 1)刪除記錄 Delete from 表名 where id ='xx' 2)刪除所有數據,并回歸初始化標識字段。 Truncate table 表名 3)delete與truncate區別 a. truncate是能使種子回到初始值 b. truncate不能加條件 c. truncate不能涉及觸發器 d. truncate性能要比delete高得多 2.更新 1)基礎的update
update 表名 set [列名]='值' where [列名] ='值'
2)和replace一起使用 --19歲以上名字中的'星'特換成'★'。
update 表名 set name = replace(name,'星','★') where age > 19