TRUNCATE
臺濘
TRUNCATE [ TABLE ] name [, ...] [ CASCADE | RESTRICT ]
柟誄
TRUNCATE 媆锘婄傯婔幖臘婺役鍴欔橬臯㔗垄启婘懟婻臘婪誕臯方溇傽䔇 DELETE 橬劯湙䔇昽悩婉誺啹婺垄婉啔臘欆柟啹蔯媆冖崔㔗婘崓臘婪橔橬䫘㔗
埗昄
- name
襕橙䷺䔇臘劉庖(埇傖橬昇嚟媞閄)
- CASCADE
亓蕫橙䷺欔橬婘臖臘婪橬崡髞嚘䫘䔇臘潡蔙䫌庯 CASCADE 蔯赆時媹彄䂇婺䔇臘㔗
- RESTRICT
套悩噽傡臘婘臖臘婪橬崡髞嚘䫘彍拐䂺橙䷺㔗認滇䚺䩕㔗
濘懟
埻橬臘䔇欔橬蔙埇傖 TRUNCATE 垄㔗
套悩傯噽垄臘橬彄昊婻臘䔇崡髞嚘䫘闼幽儌婉脘凹臖臘嘪䫘 TRUNCATE 鍴麂認底臘婘劯婔婻变傴婺幘赆橙䷺㔗婘認䓉愙喕婋演昖橬昽攓襕挗誕臯臘欆柟蔯 TRUNCATE 幽婉啔認湙䔇庋愙㔗CASCADE 锬釹埇傖䫘庯亓蕫寙劆欔橬冺蕡臘嘖滇嘪䫘溴锬亪媙釂剕彖償媄劥彍埇脘婵崌寘橸婉愿婵崌䔇昄扞㔗
TRUNCATE 婉嚔誊臯傂嘘婘臖臘婪䔇 ON DELETE 蓥埏単㔗
冋床
橙䷺ bigtable 启 fattable 臘
TRUNCATE TABLE bigtable, fattable;
橙䷺ othertable 臘幽婫亓蕫橙䷺欔橬锔誺崡髞亥溘嚘䫘 othertable 䔇臘
TRUNCATE othertable CASCADE;
噚垹攓
SQL 湺庖麯澇橬 TRUNCATE 变傴㔗