{"id":4828,"date":"2018-06-21T21:42:04","date_gmt":"2018-06-21T12:42:04","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=4828"},"modified":"2023-05-27T23:17:52","modified_gmt":"2023-05-27T14:17:52","slug":"%e3%80%90sql%e3%80%91%e3%80%8ctruncate%e6%96%87%e3%80%8d%e3%81%a8%e3%80%8cdelete%e6%96%87%e3%80%8d%e3%81%ae%e9%81%95%e3%81%84","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=4828","title":{"rendered":"\u3010SQL\u3011\u300cDELETE\u6587\u300d\u3068\u300cTRUNCATE\u6587\u300d\u306e\u9055\u3044"},"content":{"rendered":"<h2>DELETE\u6587<\/h2>\n<pre class=\"lang:default decode:true\">DELETE \u30c6\u30fc\u30d6\u30eb\u540d where \u30ab\u30e9\u30e0\u540d = \"\u6761\u4ef6\";<\/pre>\n<ul>\n<li><span style=\"color: #ff0000;\"><strong>\u6a19\u6e96SQL\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u304a\u308a\u3001\u6c4e\u7528\u6027\u304c\u9ad8\u3044<\/strong><\/span>\u3067\u3059\u3002<\/li>\n<li>DML(\u30c7\u30fc\u30bf\u64cd\u4f5c\u8a00\u8a9e)\u306e\u4e00\u7a2e\u3067\u3042\u308a\u3001\u81ea\u52d5\u3067COMMIT\u306f\u3055\u308c\u308b\u3053\u3068\u306f\u306a\u3044\u306e\u3067\u30b3\u30df\u30c3\u30c8\u3057\u3066\u3044\u306a\u3051\u308c\u3070<span style=\"color: #ff0000;\"><strong>\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u53ef\u80fd<\/strong><\/span>\u3067\u3059\u3002<\/li>\n<li>DELETE\u6a29\u9650\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\uff08TRUNCATE\u3068\u306f\u5fc5\u8981\u306a\u6a29\u9650\u304c\u7570\u306a\u308a\u307e\u3059\u3002\uff09<\/li>\n<li>DML\u306e\u4e2d\u3067\u3082\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306f\u304b\u306a\u308a\u60aa\u3044\u51e6\u7406\u3067\u3059\u3002<\/li>\n<li>WHERE\u53e5\u3067\u524a\u9664\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<li><span style=\"color: #ff0000;\"><strong>\u30aa\u30fc\u30c8\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u306f\u524a\u9664\u3055\u308c\u306a\u3044<\/strong><\/span>\u306e\u3067\u4eee\u306b\u5168\u884c\u524a\u9664\u3057\u305f\u3068\u3057\u3066\u30821\u304b\u3089\u63a1\u756a\u306f\u3057\u306a\u3044\u3067\u3059\u3002<\/li>\n<li>\u30cf\u30a4\u30a6\u30a9\u30fc\u30bf\u30fc\u30de\u30fc\u30af\uff08HWM\uff09\u3092\u30af\u30ea\u30a2\u3057\u307e\u305b\u3093\u3002<\/li>\n<\/ul>\n<h2>TRUNCATE\u6587<\/h2>\n<pre class=\"lang:default decode:true \">TRUNCATE TABLE \u30c6\u30fc\u30d6\u30eb\u540d;<\/pre>\n<p>\u6a19\u6e96SQL\u306b\u306f\u306a\u3044\u3067\u3059\u304c\u3001<span style=\"color: #ff0000;\"><strong>\u30e1\u30b8\u30e3\u30fc\u306aRDBMS\u3067\u306f\u305f\u3044\u3066\u3044\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/strong><\/span>\uff08Orale\u3001SQL Server\u3001PostgreSQL\u3001MySQL\u3001DB2\u7b49\uff09<\/p>\n<p>\u305f\u3060\u3001RDBMS\u306b\u3088\u3063\u3066\u5fae\u5999\u306b\u4ed5\u69d8\u304c\u7570\u306a\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u6ce8\u610f\u3067\u3059\u3002DELETE\u6587\u306b\u6bd4\u3079\u308b\u3068\u3001\u975e\u5e38\u306b\u51e6\u7406\u901f\u5ea6\u304c\u901f\u3044\u3067\u3059\u3002\u4e00\u90e8\u306e\u884c\u3060\u3051\u524a\u9664\u3059\u308b\u3068\u3044\u3046\u3088\u3046\u306a\u7d30\u304b\u3044\u5236\u5fa1\u3092\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<ul>\n<li>DDL(\u30c7\u30fc\u30bf\u5b9a\u7fa9\u8a00\u8a9e)\u306e\u4e00\u7a2e\u3002DDL\u306a\u306e\u3067\u5b9f\u884c\u306b\u306fDROP TABLE\u3068\u540c\u3058\u3088\u3046\u306bDROP\u6a29\u9650\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002(DELETE\u3068\u306f\u5fc5\u8981\u306a\u6a29\u9650\u304c\u7570\u306a\u308a\u307e\u3059\u3002\uff09<\/li>\n<li><span style=\"color: #ff0000;\"><strong>\u30aa\u30fc\u30c8\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3082\u524a\u9664\u3055\u308c\u308b<\/strong><\/span>\u306e\u3067\u3001\u6b21\u306b\u30c7\u30fc\u30bf\u3092\u633f\u5165\u3059\u308b\u969b\u306f1\u304b\u3089\u63a1\u756a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n<li><span style=\"color: #ff0000;\"><strong>\u81ea\u52d5COMMIT\uff08\u5373\u53cd\u6620\uff09<\/strong><\/span>\u306b\u306a\u308b\u306e\u3067<span style=\"color: #ff0000;\"><strong>\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u3067\u304d\u306a\u3044<\/strong><\/span>\u306e\u3067\u6ce8\u610f\u3067\u3059\u3002(PostgreSQL\u3060\u3051\u306f\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u304d\u308b\u30b1\u30fc\u30b9\u3082\u3042\u308b\u3088\u3046\u3067\u3059\u3002)<\/li>\n<li>\u30cf\u30a4\u30a6\u30a9\u30fc\u30bf\u30fc\u30de\u30fc\u30af\uff08HWM\uff09\u3092\u30af\u30ea\u30a2\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<h3>\u306a\u305cTRUNCATE\u6587\u306f\u901f\u3044\u306e\u304b\uff1f<\/h3>\n<p>DELETE\u6587\u30ec\u30b3\u30fc\u30c9\u306e\u8a18\u9332\u3092\u4fdd\u6301\u3059\u308b\u4ed5\u7d44\u307f\u304c\u3042\u308a\u305d\u308c\u3092\u4f7f\u3063\u3066\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u306b\u6d3b\u7528\u3059\u308b\u4ed5\u69d8\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001TRUNCATE\u6587\u306f\u8a18\u9332\u3092\u4fdd\u6301\u3059\u308b\u4f59\u8a08\u306a\u51e6\u7406\u304c\u306a\u3044\u305f\u3081\u3067\u3059\u3002<\/p>\n<h2>\u5168\u4ef6\u524a\u9664\u3059\u308b\u6642\u9593\u306f\u3069\u308c\u304f\u3089\u3044\u306e\u5dee\u306b\u306a\u308b\u306e\u304b\uff1f<\/h2>\n<p>\u30ec\u30b3\u30fc\u30c9\u4ef6\u6570\u3084RDBMS\u3084\u304a\u4f7f\u3044\u306e\u30b5\u30fc\u30d0\u30fc\u30b9\u30da\u30c3\u30af\u306b\u3088\u3063\u3066\u3082\u9055\u3046\u306e\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070100\u4e07\u4ef6\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308b\u30c6\u30fc\u30d6\u30eb\u3067\u3042\u308c\u3070\u3001DELETE\u6587\u306f10\u5206\u7a0b\u5ea6\u3082\u6642\u9593\u304c\u304b\u304b\u3063\u305f\u308a\u3057\u307e\u3059\u304c\u3001TRUNCATE\u6587\u3067\u3042\u308c\u3070\u306a\u3093\u30681\u79d2\u3082\u304b\u304b\u3089\u305a\u306b\u524a\u9664\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002\u305d\u308c\u304f\u3089\u3044\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u3059\u308b\u305f\u3081\u306e\u60c5\u5831\u306e\u8a18\u9332\u306b\u306f\u30b3\u30b9\u30c8\u304c\u304b\u304b\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"DELETE\u6587 DELETE \u30c6\u30fc\u30d6\u30eb\u540d where \u30ab\u30e9\u30e0\u540d = \"\u6761\u4ef6\"; \u6a19\u6e96SQL\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u304a\u308a\u3001\u6c4e\u7528\u6027\u304c\u9ad8\u3044\u3067\u3059\u3002 DML(\u30c7\u30fc\u30bf\u64cd\u4f5c\u8a00\u8a9e)\u306e\u4e00\u7a2e\u3067\u3042\u308a\u3001\u81ea\u52d5\u3067COMMIT\u306f\u3055\u308c\u308b\u3053\u3068\u306f\u306a\u3044\u306e\u3067\u30b3\u30df\u30c3\u30c8\u3057\u3066\u3044 [&hellip;]","protected":false},"author":1,"featured_media":4823,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/4828"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4828"}],"version-history":[{"count":11,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/4828\/revisions"}],"predecessor-version":[{"id":20588,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/4828\/revisions\/20588"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/4823"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4828"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}