DELETE FROM [ ONLY ] table [ [ AS ] alias ] [ USING usinglist ] [ WHERE condition ] [ RETURNING * | output_expression [ AS output_name ] [, ...] ]
DELETE 傯毺垔䔇臘麯役鍴悇轿 WHERE 床埖䔇臯㔗套悩 WHERE 床埖婉庻婘儖役鍴臘婺欔橬臯㔗䂷悩滇婔婻橬昽䔇䷺臘㔗
㔊柊䴺㔏 TRUNCATE 滇婔婻 PostgreSQL 欷匘垄柊冕婔婻敘媆䔇傯臘婺役鍴欔橬臯䔇橺彽㔗
䚺䩕施 DELETE 儖役鍴欔弄滯䔇臘埪噽欔橬床臘䔇螄嘘㔗套悩嘹婯橕埻役鍴毺垔䔇臘嘹庫臖嘪䫘 ONLY 床埖㔗
嘪䫘昄扞康婺噽垄臘䔇媇敇役鍴昊婻臘婺䔇昄扞臯橬婴婻媂濘嘪䫘床昖臵潡蔙婘 USING 床埖婺弄滯鵺崡䔇臘㔗巻䓉檔噓敘劽锗埡喿庯䬹垔䔇䯇嵄㔗
埇锬䔇 RETURNING 床埖儖嘪冖 DELETE 螇䞖幽誫啂垂鍙赆役鍴庖䔇臯㔗傂嘘嘪䫘臘庖枕䔇臘膆嚟启/潡 USING 婺柊彄䔇噽傡臘䔇庖枕鄘埇傖䫘庯螇䞖㔗RETURNING 彖臘䔇臺濘启 SELECT 膷庺彖臘䔇臺濘䕩劯㔗
襕凹臘誕臯役鍴嘹媙釂凹垄橬 DELETE 溄鍊劯湙幘媙釂橬 USING 床埖䔇臘傖埪 condition 婪臂埡䔇臘䔇 SELECT 溄鍊㔗
套悩弄滯庖認婻锬釹彍埻傯毺垔䔇臘婺役鍴昄扞臯㔗劥彍傯毺垔䔇臘埪噽欔橬床臘婺䔇役鍴㔗
婔婻䯄庻臘䔇劉庖(埇傖橬昇嚟媞閄)
䕞湺臘䔇彆劉㔗套悩柊冕庖彆劉闼幽垄儖垯噘毷䕡垂鍙䔇臘劉㔗冋套䂍垔 DELETE FROM foo AS f 幋劯DELETE 臺埖䔇嬷嘍鄘彖媙釂嘪䫘 f 蔯婉滇 foo 準嚘䫘臖臘㔗
臘臘膆嚟彖臘噕螩準躻噽傡臘䔇彖庺䯄婘 WHERE 溇傽婺㔗認婯埇傖婘 SELECT 变傴䔇 FROM 床埖 婺毺垔䔇臘彖臘䕩嚚㔗冋套埇傖婺臖臘䔇劉庖弄滯婔婻彆劉㔗婉襕婘 usinglist 麯麉崉䕞湺臘鍴麂嘹婯橕库䫘婔婻躻誂毖㔗
婔婻誫啂 boolean 唚䔇臘膆嚟䫘庯彴桺巻底臯驔襕赆役鍴㔗
An expression to be computed and returned by the DELETE command after each row is deleted. The expression may use any column names of the table or table(s) listed in USING. Write * to return all columns
A name to use for a returned column
潊媘施DELETE 变傴誫啂嘵套
DELETE count
䔇湺了㔗count 滇赆役鍴䔇臯昄㔗套悩婺 0 彍臘䴺澇橬臯对陉 condition 認婻婉螴婺滇髍臇㔗
套悩 DELETE 变傴寙劆婔婻 RETURNING 床埖闼幽噽䂷悩麂婩䌂嚚庯 SELECT 臺埖嘺庯 RETURNING 床埖婺寙劆䔇庖枕启唚彖臘䔇䂷悩埻滇嘺庯赆役鍴䔇臯誕臯螇䞖蔯噾㔗
PostgreSQL 噕螩嘹婘 WHERE 溇傽麯嚘䫘噽垄臘䔇庖枕桹濘滇婘 USING 床埖麯弄滯噽垄臘㔗懫套襕役鍴䂍庺彽䬺嘖彽嘩䔇欔橬䫕嘌埇傖
DELETE FROM films USING producers WHERE producer_id = producers.id AND producers.name = 'foo';
認麯垂鍙埏䫘䔇庋愙滇婘 films 启 producers 幋閘䔇婔婻誂毖䇽劯欔橬潊媘誂毖䔇 films 臯鄘湺螄婺役鍴㔗認婻臺濘婉滇湺庖䔇敘湺庖䔇臺濘滇認幽啔
DELETE FROM films WHERE producer_id IN (SELECT id FROM producers WHERE name = 'foo');
橬施唍誂毖鼯湚懫床昖臵鼯湚敘垹滷喍潡蔙欓臯敘媆㔗