{"id":7722,"date":"2021-08-23T08:54:11","date_gmt":"2021-08-23T00:54:11","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=7722"},"modified":"2021-08-23T11:23:39","modified_gmt":"2021-08-23T03:23:39","slug":"gbase-8a%e7%9a%84%e6%95%b0%e5%ad%97%e7%b1%bb%e5%9e%8b%e9%95%bf%e5%ba%a6%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/7722","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u7684\u6570\u5b57\u7c7b\u578bint,bigint,decimal\u957f\u5ea6\u9650\u5236\u6d4b\u8bd5"},"content":{"rendered":"<p>\u6839\u636e\u6d4b\u8bd5\u7ed3\u679c\uff0cGBase 8a\u6570\u636e\u5e93\u7684\u6570\u5b57\u7c7b\u578b\u957f\u5ea6\uff0cint\u548cbigint\u5e76\u6ca1\u6709\u505a\u3010\u4e25\u683c\u3011\u7684\u9650\u5236\uff0c\u9664\u975e\u8d85\u8fc7\u4e86\u7c7b\u578b\u5141\u8bb8\u7684\u6700\u5927\u957f\u5ea6\u3002\u7b97\u4e0a\u8d1f\u6570\u7684\u6807\u5fd7\uff0cint\u6700\u957f11\u4f4d\uff0cbigint\u662f20\u4f4d\u3002decimal\u505a\u4e86\u4e25\u683c\u9650\u5236\uff0c\u8d85\u4e86\u957f\u5ea6\u4f1a\u62a5\u9519\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2b3528f1259\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2b3528f1259\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/7722\/#%E5%8F%82%E8%80%83\" >\u53c2\u8003<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/7722\/#%E6%B5%8B%E8%AF%95%E8%A1%A8\" >\u6d4b\u8bd5\u8868<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/7722\/#%E6%B5%8B%E8%AF%95int3\" >\u6d4b\u8bd5int(3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/7722\/#%E6%B5%8B%E8%AF%95int3%E5%8A%A0%E8%BD%BD\" >\u6d4b\u8bd5int(3)\u52a0\u8f7d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/7722\/#%E6%B5%8B%E8%AF%95%E9%BB%98%E8%AE%A4int\" >\u6d4b\u8bd5\u9ed8\u8ba4int<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/7722\/#Bigint%E6%B5%8B%E8%AF%95\" >Bigint\u6d4b\u8bd5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/7722\/#Decimal%E7%B1%BB%E5%9E%8B%E6%B5%8B%E8%AF%95\" >Decimal\u7c7b\u578b\u6d4b\u8bd5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.gbase8.cn\/en\/7722\/#%E6%80%BB%E7%BB%93\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83\"><\/span>\u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/en\/1609\/\">GBase 8a\u76f8\u540c\u6570\u636e\u5728\u4e0d\u540c\u6570\u5b57\u5b57\u6bb5\u7c7b\u578b\u4e0b\u7684\u78c1\u76d8\u5360\u7528\u60c5\u51b5\u9a8c\u8bc1<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/en\/803\/\">GBase 8a\u6570\u636e\u5e93\u96c6\u7fa4\u57fa\u672c\u6280\u672f\u6307\u6807<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E8%A1%A8\"><\/span>\u6d4b\u8bd5\u8868<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u957f\u5ea6\u4e3a3\u7684int\u7c7b\u578b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table t1(id int(3));\nQuery OK, 0 rows affected (Elapsed: 00:00:00.14)\n\ngbase&gt; desc t1;\n+-------+--------+------+-----+---------+-------+\n| Field | Type   | Null | Key | Default | Extra |\n+-------+--------+------+-----+---------+-------+\n| id    | int(3) | YES  |     | NULL    |       |\n+-------+--------+------+-----+---------+-------+\n1 row in set (Elapsed: 00:00:00.01)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95int3\"><\/span>\u6d4b\u8bd5int(3)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5206\u522binsert\u957f\u5ea6\u4e3a3\uff0c4\uff0c9\uff0c10\u7684\u6570\u5b57\uff0c\u5747\u6b63\u5e38\u5165\u5e93\u3002\u957f\u5ea6\u4e3a11\u7684\uff0c\u62a5\u8d85\u8fc7\u6570\u5b57\u8303\u56f4\u7684\u9519\u8bef\u3002\u800c2\u768431\u6b21\u65b9\uff0c\u957f\u5ea6\u4e3a10\uff0c\u7b97\u4e0a\u8d1f\u53f7\uff0c\u6b63\u597d11\u4f4d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; insert into t1 values(123);\nQuery OK, 1 row affected (Elapsed: 00:00:00.09)\n\ngbase&gt; insert into t1 values(1234);\nQuery OK, 1 row affected (Elapsed: 00:00:00.10)\n\ngbase&gt; insert into t1 values(123456789);\nQuery OK, 1 row affected (Elapsed: 00:00:00.09)\n\ngbase&gt; insert into t1 values(1234567890);\nQuery OK, 1 row affected (Elapsed: 00:00:00.09)\n\ngbase&gt; insert into t1 values(12345678901);\nERROR 1264 (22003): Out of range value for column 'id' at row 1\ngbase&gt; select power(2,31);\n+-------------+\n| power(2,31) |\n+-------------+\n|  2147483648 |\n+-------------+\n1 row in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95int3%E5%8A%A0%E8%BD%BD\"><\/span>\u6d4b\u8bd5int(3)\u52a0\u8f7d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u53ef\u4ee5\u6b63\u5e38\u52a0\u8f7d\uff0c\u4e0d\u4f1a\u56e0\u4e3a\u957f\u5ea6\u8d85\u8fc73\u800c\u62a5\u9519\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; select * from t1;\n+------------+\n| id         |\n+------------+\n|        123 |\n|       1234 |\n|  123456789 |\n| 1234567890 |\n+------------+\n4 rows in set (Elapsed: 00:00:00.02)\n\ngbase&gt; load data infile 'ftp:\/\/gbase:gbase1234@10.0.2.101\/t1_2.txt' into table t1;\nQuery OK, 10 rows affected (Elapsed: 00:00:00.40)\nTask 21 finished, Loaded 10 records, Skipped 0 records\n\ngbase&gt; select * from t1;\n+------------+\n| id         |\n+------------+\n|        123 |\n|       1234 |\n|  123456789 |\n| 1234567890 |\n|      13700 |\n|       7748 |\n|      27384 |\n|      32486 |\n|      10580 |\n|       1371 |\n|      10886 |\n|      28139 |\n|      12636 |\n|      25419 |\n+------------+\n14 rows in set (Elapsed: 00:00:00.01)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E9%BB%98%E8%AE%A4int\"><\/span>\u6d4b\u8bd5\u9ed8\u8ba4int<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u957f\u5ea6\u4f4d11\u4f4d\uff0c\u8981\u5305\u542b\u8d1f\u53f7\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table t2(id int);\nQuery OK, 0 rows affected (Elapsed: 00:00:00.15)\n\ngbase&gt; desc t2;\n+-------+---------+------+-----+---------+-------+\n| Field | Type    | Null | Key | Default | Extra |\n+-------+---------+------+-----+---------+-------+\n| id    | int(11) | YES  |     | NULL    |       |\n+-------+---------+------+-----+---------+-------+\n1 row in set (Elapsed: 00:00:00.00)\n\ngbase&gt; insert into t2 values(-1234567890);\nQuery OK, 1 row affected (Elapsed: 00:00:00.09)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Bigint%E6%B5%8B%E8%AF%95\"><\/span>Bigint\u6d4b\u8bd5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6700\u957f19\u4f4d\uff0c\u7b97\u4e0a\u8d1f\u53f7\u662f20\u4f4d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table t3(id bigint);\nQuery OK, 0 rows affected (Elapsed: 00:00:00.14)\n\ngbase&gt; desc t3;\n+-------+------------+------+-----+---------+-------+\n| Field | Type       | Null | Key | Default | Extra |\n+-------+------------+------+-----+---------+-------+\n| id    | bigint(20) | YES  |     | NULL    |       |\n+-------+------------+------+-----+---------+-------+\n1 row in set (Elapsed: 00:00:00.00)\n\ngbase&gt; insert into t3 values (-1234567890123456789);\nQuery OK, 1 row affected (Elapsed: 00:00:00.10)\n\ngbase&gt; insert into t3 values (-12345678901234567890);\nERROR 1264 (22003): Out of range value for column 'id' at row 1\ngbase&gt;\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Decimal%E7%B1%BB%E5%9E%8B%E6%B5%8B%E8%AF%95\"><\/span>Decimal\u7c7b\u578b\u6d4b\u8bd5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>decimal\u4e25\u683c\u505a\u4e86\u957f\u5ea6\u9650\u5236\uff0c\u8d1f\u53f7\u4e0d\u5728\u8303\u56f4\u5185\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase> create table t4(id decimal(5));\r\nQuery OK, 0 rows affected (Elapsed: 00:00:00.15)\r\n\r\ngbase> insert into t4 values(1234);\r\nQuery OK, 1 row affected (Elapsed: 00:00:00.09)\r\n\r\ngbase> insert into t4 values(12345);\r\nQuery OK, 1 row affected (Elapsed: 00:00:00.09)\r\n\r\ngbase> insert into t4 values(123456);\r\nERROR 1264 (22003): Out of range value for column 'id' at row 1\n\r\ngbase> insert into t4 values(-12345);\r\nQuery OK, 1 row affected (Elapsed: 00:00:00.09)\r\n\r\ngbase> select * from t4;\r\n+--------+\r\n| id     |\r\n+--------+\r\n|   1234 |\r\n|  12345 |\r\n| -12345 |\r\n+--------+\r\n3 rows in set (Elapsed: 00:00:00.01)\r\n\r\ngbase> desc t4;\r\n+-------+--------------+------+-----+---------+-------+\r\n| Field | Type         | Null | Key | Default | Extra |\r\n+-------+--------------+------+-----+---------+-------+\r\n| id    | decimal(5,0) | YES  |     | NULL    |       |\r\n+-------+--------------+------+-----+---------+-------+\r\n1 row in set (Elapsed: 00:00:00.00)\r\n\r\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%80%BB%E7%BB%93\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5bf9int\u3001bigint\u7c7b\u578b\uff0c\u53ea\u8981\u4e0d\u8d85\u8fc7\u5176\u8303\u56f4\u9650\u5236\uff0c\u4ece\u5b9e\u73b0\u770b\u5e76\u4e0d\u5bf9\u5176\u957f\u5ea6\u505a\u3010\u4e25\u683c\u3011\u9650\u5236\u3002decimal\u505a\u4e86\u4e25\u683c\u9650\u5236\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u6839\u636e\u6d4b\u8bd5\u7ed3\u679c\uff0cGBase 8a\u6570\u636e\u5e93\u7684\u6570\u5b57\u7c7b\u578b\u957f\u5ea6\uff0cint\u548cbigint\u5e76\u6ca1\u6709\u505a\u3010\u4e25\u683c\u3011\u7684\u9650\u5236\uff0c\u9664\u975e\u8d85\u8fc7\u4e86\u7c7b\u578b\u5141\u8bb8\u7684\u6700\u5927\u957f\u5ea6\u3002\u7b97\u4e0a\u8d1f\u6570\u7684\u6807\u5fd7\uff0cint\u6700\u957f11\u4f4d\uff0cbigint\u662f20\u4f4d\u3002decimal\u505a\u4e86\u4e25\u683c\u9650\u5236\uff0c\u8d85\u4e86\u957f\u5ea6\u4f1a\u62a5\u9519\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-7722","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/7722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=7722"}],"version-history":[{"count":6,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/7722\/revisions"}],"predecessor-version":[{"id":7751,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/7722\/revisions\/7751"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=7722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=7722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=7722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}