{"id":1406,"date":"2018-04-25T22:06:49","date_gmt":"2018-04-25T13:06:49","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=1406"},"modified":"2018-04-25T22:38:20","modified_gmt":"2018-04-25T13:38:20","slug":"%e3%80%90%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99%e3%83%bc%e3%82%b9%e8%a8%ad%e8%a8%88%e3%80%91%e6%8e%a1%e7%95%aa%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=1406","title":{"rendered":"\u3010\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8a2d\u8a08\u3011\u63a1\u756a\u306b\u3064\u3044\u3066"},"content":{"rendered":"<p>\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u3001\u305d\u306e\u30c6\u30fc\u30d6\u30eb\u3067\u5fc5\u305a\u4e00\u610f\u3068\u306a\u308b\u3088\u3046\u306b\u3001<span style=\"color: #ff0000;\"><strong>\u4e3b\u30ad\u30fc<\/strong><\/span>\u3092\u8a2d\u5b9a\u3059\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u4e3b\u30ad\u30fc\u306f\u3001\u57fa\u672c\u7684\u306b\u306f\u3001\u9023\u756a\u306b\u306a\u308b\u3088\u3046\u306b\u8a2d\u8a08\u3059\u308b\u3053\u3068\u304c\u666e\u901a\u3067\u3059\u3002<\/strong><\/span><\/p>\n<p>\u3068\u3059\u308b\u3068\u3001\u6700\u5f8c\u306b\u4f7f\u7528\u3057\u305f\u756a\u53f7\u3092\u3069\u3053\u304b\u306b\u8a18\u9332\u3057\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><strong>\u4e3b\u30ad\u30fc\u306e\u63a1\u756a\u306f\u3044\u304f\u3064\u304b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/strong><\/p>\n<h2>\u65b9\u6cd5\uff11\uff1a\u63a1\u756a\u30c6\u30fc\u30d6\u30eb\u3092\u7528\u610f\u3059\u308b\u3002<\/h2>\n<p>\u305d\u306e\u969b\u306f\u3001\u63a1\u756a\u7528\u306e<strong>\u300c\u63a1\u756a\u30c6\u30fc\u30d6\u30eb\u300d<\/strong>\u3092\u4f7f\u3046\u3053\u3068\u304c\u666e\u901a\u3067\u3059\u3002<\/p>\n<h3>\u63a1\u756a\u30c6\u30fc\u30d6\u30eb\u306e\u4f8b<\/h3>\n<table>\n<tbody>\n<tr>\n<th>\u9805\u76ee<\/th>\n<th>\u6700\u7d42\u767a\u884c\u756a\u53f7<\/th>\n<\/tr>\n<tr>\n<td>\u30e6\u30fc\u30b6\u30fcID<\/td>\n<td>10456<\/td>\n<\/tr>\n<tr>\n<td>\u7aef\u672bID<\/td>\n<td>14987<\/td>\n<\/tr>\n<tr>\n<td>\u5099\u54c1ID<\/td>\n<td>8765<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6700\u5927\u306e\u30e1\u30ea\u30c3\u30c8\u3068\u3057\u3066\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u5168\u3066\u306eDBMS\u3067\u540c\u3058\u3088\u3046\u306b\u4f7f\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u6c4e\u7528\u6027<\/strong><\/span>\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u305f\u3060\u3001\u3084\u306f\u308a<strong>\u5c11\u3057\u9762\u5012\u306a\u306e\u304c\u30c7\u30e1\u30ea\u30c3\u30c8<\/strong>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u65b9\u6cd5\uff12\uff1a\u9023\u756a\u63a1\u756a\u6a5f\u80fd\u3092\u4f7f\u3046\u3002<\/h2>\n<p>\u3053\u306e\u65b9\u6cd5\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u8a2d\u8a08\u3084\u5b9f\u88c5\u304c\u975e\u5e38\u306b\u697d<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u5168\u3066\u306eDBMS\u3067\u4f7f\u3048\u308b\u308f\u3051\u3067\u3082\u3042\u308a\u307e\u305b\u3093\u3057\u3001DBMS\u88fd\u54c1\u306b\u3088\u3063\u3066\u5229\u7528\u65b9\u6cd5\u304c\u7570\u306a\u308b\u306e\u3067\u3001\u3042\u307e\u308a\u63a8\u5968\u306f\u3055\u308c\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u6a5f\u80fd\u306e\u4e2d\u3067\u3082\u3001DBMS\u3054\u3068\u306b\u3044\u304f\u3064\u304b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>\u5217\u5b9a\u7fa9\u3092\u4f7f\u3046\u65b9\u6cd5<\/h3>\n<table>\n<tbody>\n<tr>\n<th>DBMS<\/th>\n<th>\u3084\u308a\u65b9<\/th>\n<\/tr>\n<tr>\n<td>SQL Server<\/td>\n<td>IDENTITY\u4fee\u98fe\u3092\u4ed8\u4e0e\u3059\u308b\u3002<\/td>\n<\/tr>\n<tr>\n<td>MySQL<\/td>\n<td>AUTO_INCREMENT\u4fee\u98fe\u3092\u4ed8\u4e0e\u3059\u308b\u3002<\/td>\n<\/tr>\n<tr>\n<td>PostgreSQL<\/td>\n<td>\u30c7\u30fc\u30bf\u578b\u306bSERIAL\u578b\u3092\u5229\u7528\u3059\u308b\u3002<\/td>\n<\/tr>\n<tr>\n<td>SQLite<\/td>\n<td>AUTOINCREMENT\u4fee\u98fe\u3092\u4ed8\u4e0e\u3059\u308b\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u4f7f\u3046\u65b9\u6cd5<\/h3>\n<p>Oracle\u3084\u3001SQL Server\u7b49\u306eDB\u3067\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u300c\u30b7\u30fc\u30b1\u30f3\u30b9\u300d\u3068\u3044\u3046\u6a5f\u80fd\u3092\u4f7f\u3046\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<h4>\u30b7\u30fc\u30b1\u30f3\u30b9\u306e\u7279\u5fb4<\/h4>\n<ul>\n<li>\u5e38\u306b\u63a1\u756a\u3057\u305f\u6700\u65b0\u306e\u5024\u3092\u8a18\u9332\u3057\u3066\u304a\u308a\u3001\u30b7\u30fc\u30b1\u30f3\u30b9\u306b\u6307\u793a\u3092\u3059\u308b\u3053\u3068\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u73fe\u5728\u306e\u5024\u300d\u3084\u300c\u6700\u65b0\u306e\u5024\u300d\u3092\u81ea\u7531\u306b\u53d6\u308a\u51fa\u3059\u3053\u3068\u304c\u53ef\u80fd<\/strong><\/span><\/li>\n<li>\u30b7\u30fc\u30b1\u30f3\u30b9\u304b\u3089\u53d6\u308a\u51fa\u3057\u305f\u5024\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u5373\u6642\u30b3\u30df\u30c3\u30c8<\/strong><span style=\"color: #000000;\">\uff08\u8907\u6570\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u304b\u3089\u306e\u5229\u7528\u3092\u60f3\u5b9a\u3057\u3066\u3044\u308b\u305f\u3081\u3002\uff09<\/span><\/span><\/li>\n<\/ul>\n<h4>\u30b7\u30fc\u30b1\u30f3\u30b9\u306e\u69cb\u6587<strong>(Oracle\u306e\u5834\u5408)<\/strong><\/h4>\n<p><strong>\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u4f5c\u6210\u3059\u308b\u3002<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nCREATE SEQUENCE \u30b7\u30fc\u30b1\u30f3\u30b9\u540d;\r\n<\/pre>\n<p><strong>\u73fe\u5728\u306e\u5024\u3092\u5f97\u308b\u3002<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT \u30b7\u30fc\u30b1\u30f3\u30b9\u540d.CURRVAL FROM DUAL;\r\n<\/pre>\n<p><strong>\u6b21\u306e\u5024\u3092\u5f97\u308b\u3002<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT \u30b7\u30fc\u30b1\u30f3\u30b9\u540d.CURRVAL FROM DUAL;\r\n<\/pre>\n<h3>\u305d\u306e\u4ed6\u65b9\u6cd5<\/h3>\n<p>\u3042\u307e\u308a\u591a\u304f\u306f\u306a\u3044\u3067\u3059\u304c\u3001INTEGER\u578b\u3067\u304b\u3064\u4e3b\u30ad\u30fc\u304c\u3064\u3044\u305f\u9805\u76ee\u306bNULL\u3092\u633f\u5165\u3059\u308b\u3068\u81ea\u52d5\u7684\u306b\u9023\u756a\u3092\u632f\u3063\u3066\u304f\u308c\u308bDB\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>\u63a1\u756a\u306b\u304a\u3044\u3066\u3001\u3042\u307e\u308a\u304a\u3059\u3059\u3081\u3067\u304d\u306a\u3044\u65b9\u6cd5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3001<span style=\"color: #ff0000;\"><strong>MAX\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3001\u6700\u5927\u5024\u3092\u53d6\u5f97\u3057\u3066\u63a1\u756a\u3059\u308b\u3068\u3044\u3046\u65b9\u6cd5<\/strong><\/span>\u3092\u601d\u3044\u3064\u304b\u308c\u305f\u65b9\u3082\u3044\u3089\u3063\u3057\u3083\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT MAX(USER_ID) + 1 AS MAX FROM USER_MASTER;\r\n<\/pre>\n<p>\u3053\u306e\u65b9\u6cd5\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u7d50\u8ad6\u304b\u3089\u7533\u3057\u307e\u3059\u3068\u3001\u304a\u3059\u3059\u3081\u3067\u304d\u307e\u305b\u3093\u3002<\/strong><\/span><\/p>\n<h3>\u7406\u7531<\/h3>\n<ul>\n<li>\u30ed\u30c3\u30af\u3092\u4f7f\u308f\u306a\u3044\u3068\u8907\u6570\u306e\u4eba\u304b\u3089\u3001\u540c\u3058\u756a\u53f7\u304c\u63a1\u756a\u3055\u308c\u3066\u3057\u307e\u3046\u53ef\u80fd\u6027\u304c\u3042\u308b\u70b9<\/li>\n<li>\u6700\u5f8c\u306b\u63a1\u756a\u3057\u305f\u884c\u304c\u524a\u9664\u3055\u308c\u3066\u3057\u307e\u3046\u3068\u3001\u307e\u305f\u540c\u3058\u756a\u53f7\u3092\u4f7f\u3046\u3053\u3068\u306b\u306a\u308b\u70b9<\/li>\n<\/ul>\n<p>\u5927\u304d\u306a\u7406\u7531\u306f\u4e00\u70b9\u76ee\u306e\u7406\u7531\u3067\u3057\u3087\u3046\u3002<span style=\"color: #ff0000;\"><strong>\u3067\u304d\u308b\u3060\u3051\u3001\u63a1\u756a\u30c6\u30fc\u30d6\u30eb\u3084\u3001\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u4f7f\u3063\u3066\u63a1\u756a\u306e\u4ed5\u7d44\u307f\u3092\u8a2d\u8a08\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/strong><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u3001\u305d\u306e\u30c6\u30fc\u30d6\u30eb\u3067\u5fc5\u305a\u4e00\u610f\u3068\u306a\u308b\u3088\u3046\u306b\u3001\u4e3b\u30ad\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002 \u4e3b\u30ad\u30fc\u306f\u3001\u57fa\u672c\u7684\u306b\u306f\u3001\u9023\u756a\u306b\u306a\u308b\u3088\u3046\u306b\u8a2d\u8a08\u3059\u308b\u3053\u3068\u304c\u666e\u901a\u3067\u3059\u3002 \u3068\u3059\u308b\u3068\u3001\u6700\u5f8c\u306b\u4f7f\u7528\u3057\u305f\u756a\u53f7\u3092\u3069\u3053\u304b\u306b\u8a18\u9332\u3057\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 \u4e3b [&hellip;]","protected":false},"author":1,"featured_media":1425,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1406"}],"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=1406"}],"version-history":[{"count":18,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1406\/revisions"}],"predecessor-version":[{"id":1424,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1406\/revisions\/1424"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/1425"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1406"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}