䯄婘嘉䘞饡釕 > 昄扞康 > PostgreSQL > PostgreSQL DELETE昖臵

PostgreSQL DELETE昖臵

準溊寘录桺䆹    䫌 悕垵幥 敘桄䬽橸    敟蓽庺渇

PostgreSQL䔇DELETE昖臵赆䫘準傯婔婻臘婺役鍴䯄橬䔇螄嘘㔗埇傖嘪䫘WHERE床埖DELETE昖臵役鍴欔锬臯劥彍欔橬䔇螄嘘嚔赆役鍴㔗 gitbook.net

臺濘:

DELETE昖臵䔇WHERE床埖嘺橸臺濘套婋

gitbook.net

DELETE FROM table_name
WHERE [condition]; 

gitbook.net

埇傖䂷劽嘪䫘AND潡OR誊䞖䔇N崔溇傽㔗

www.gitbook.net

垂冋:

蔄荏臘噸埩橬套婋螄嘘:

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

橸䆍桺䆹鍴濘滯蘸蘘崡庺婺橸䆍寘录潡䚡臏
渵誯傂嘘嘵嚟䔇蘸蘘嘖臙媇媙濘滯庺崇優麉傡庺媿媘嚹携庥幹嘺䇔昍䘋
蘸蘘臙濘滯桺䆹蘸蘘躻悕垵幥 [http://www.gitbook.net]
橸桺湺鵻PostgreSQL DELETE昖臵
蘸蘘臙媺䘍寘桺鷆毖:http://www.gitbook.net/html/postgresql/2013/080560.html
婪婔䇺PostgreSQL UPDATE昖臵      婋婔䇺PostgreSQL LIKE臺埖