PostgreSQL䔇DELETE昖臵赆䫘準傯婔婻臘婺役鍴䯄橬䔇螄嘘㔗埇傖嘪䫘WHERE床埖DELETE昖臵役鍴欔锬臯劥彍欔橬䔇螄嘘嚔赆役鍴㔗 gitbook.net
DELETE昖臵䔇WHERE床埖嘺橸臺濘套婋
DELETE FROM table_name WHERE [condition];gitbook.net
埇傖䂷劽嘪䫘AND潡OR誊䞖䔇N崔溇傽㔗
www.gitbook.net
蔄荏臘噸埩橬套婋螄嘘:
# select * from COMPANY; id | name | age | address | salary ----+-------+-----+-----------+-------- 1 | Paul | 32 | California| 20000 2 | Allen | 25 | Texas | 15000 3 | Teddy | 23 | Norway | 20000 4 | Mark | 25 | Rich-Mond | 65000 5 | David | 27 | Texas | 85000 6 | Kim | 22 | South-Hall| 45000 7 | James | 24 | Houston | 10000 (7 rows)www.gitbook.net
傖婋滇婔婻冋床垄嚔役鍴噽ID婺2䔇垵潙 www.gitbook.net
testdb=# DELETE FROM COMPANY WHERE ID = 2; gitbook.net
䯄婘噸埩臘儖橬傖婋螄嘘 www.gitbook.net
id | name | age | address | salary ----+-------+-----+-------------+-------- 1 | Paul | 32 | California | 20000 3 | Teddy | 23 | Norway | 20000 4 | Mark | 25 | Rich-Mond | 65000 5 | David | 27 | Texas | 85000 6 | Kim | 22 | South-Hall | 45000 7 | James | 24 | Houston | 10000 (6 rows) www.gitbook.net
套悩愿傯噸埩臘婺役鍴欔橬螄嘘彍婉驔襕嘪䫘WHERE床埖䔇DELETE昖臵套婋 www.gitbook.net
testdb=# DELETE FROM COMPANY; www.gitbook.net
噸埩臘婺澇橬傂嘘螄嘘啹婺欔橬䔇螄嘘噾赆役鍴䔇DELETE臺埖㔗 gitbook.net