{"id":2556,"date":"2013-02-06T12:02:10","date_gmt":"2013-02-06T03:02:10","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=2556"},"modified":"2013-12-30T01:39:31","modified_gmt":"2013-12-29T16:39:31","slug":"post-2556","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/sql\/2556","title":{"rendered":"[SQL]PostgreSQL\u306e\u5e7e\u4f55\u30c7\u30fc\u30bf\u6f14\u7b97\u5b50TIPS"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/02\/posGeometry.jpg\" alt=\"posGeometry\" width=\"406\" height=\"284\" class=\"aligncenter size-full wp-image-2557\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/02\/posGeometry.jpg 406w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/02\/posGeometry-214x150.jpg 214w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/p>\n<p>PostgreSQL\u306b\u306f\u8c4a\u5bcc\u306a\u5e7e\u4f55\u30c7\u30fc\u30bf\u578b\u3068\u5e7e\u4f55\u30c7\u30fc\u30bf\u3092\u6271\u3046\u305f\u3081\u306e\u6f14\u7b97\u5b50\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.postgresql.jp\/document\/8.1\/html\/datatype-geometric.html\">\u5e7e\u4f55\u30c7\u30fc\u30bf\u578b<\/a><br \/>\n<a href=\"http:\/\/www.postgresql.jp\/document\/8.1\/html\/functions-geometry.html\">\u5e7e\u4f55\u95a2\u6570\u3068\u6f14\u7b97\u5b50<\/a><\/p>\n<p>\u4e3b\u306b\u5730\u7406\u30c7\u30fc\u30bf\u3092\u6271\u3046\u6642\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3059\u304c\u3001\u5730\u7406\u30c7\u30fc\u30bf\u4ee5\u5916\u306b\u4f7f\u3063\u3066\u3082\u4fbf\u5229\u306a\u52b9\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u3042\u308b\u4e8c\u3064\u306e\u30c7\u30fc\u30bf\uff08\u3053\u3053\u3067\u306f\u3001\u300c\u4fa1\u683c\u300d\u3068\u300c\u5927\u304d\u3055\u300d\u3068\u3057\u307e\u3059)\u304c\u3001\u6700\u5927\u5024\u304b\u3089\u3069\u308c\u3060\u3051\u96e2\u308c\u3066\u3044\u308b\u304b\u3092\u6c42\u3081\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u30af\u30a8\u30ea\u3067\u6700\u5927\u5024\u304b\u3089\u306e\u8ddd\u96e2\u304c\u6c42\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\uff08\u5148\u306b\u6c42\u3081\u3066\u304a\u3044\u305f\u6700\u5927\u5024\u3068\u6bd4\u8f03\u3057\u305f\u3044\u30ab\u30e9\u30e0\u3092\u3001\u305d\u308c\u305e\u308cpoint\u578b\u306b\u578b\u5909\u63db\u3057\u305f\u306e\u3061\u300c<->\u300d\u6f14\u7b97\u5b50\u3067\uff12\u70b9\u306e\u8ddd\u96e2\u3092\u51fa\u529b\u3057\u307e\u3059\uff09<\/p>\n<pre class=\"lang:pgsql decode:true \" >SELECT point(price, itemSize) &lt;-&gt; point(maxPrice, maxItemSize) from example_table\r\n<\/pre>\n<p>\u3042\u308b\u3044\u306f\u3001\u8907\u6570\u306e\u30ab\u30e9\u30e0\u306e\u5024\u304c\u3001\u3042\u308b\u7bc4\u56f2\u5185\u306b\u53ce\u307e\u3063\u3066\u3044\u308b\u304b\u3069\u3046\u304b\uff1f\u3000\u306f\u4ee5\u4e0b\u306e\u30af\u30a8\u30ea\u3067\u5224\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:pgsql decode:true \" >select box(point(price, itemSize), point(cost, amant)) ~ box(point(5000, 60), point(1200, 10)) from example_table\r\n<\/pre>\n<p>\u5404\u30ab\u30e9\u30e0\u306e\u5024\u304c\u3001\u6307\u5b9a\u3057\u305f\u7bc4\u56f2\u5185\u306b\u53ce\u307e\u3063\u3066\u3044\u308c\u3070\u300c\u771f\u300d\u304c\u8fd4\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u4ed6\u306b\u3082\u3001\u30c7\u30fc\u30bf\u304c\u6307\u5b9a\u3057\u305f\u7bc4\u56f2\u3088\u308a\u53f3\u306b\u6709\u308b\u304b\u5de6\u306b\u3042\u308b\u304b\uff1f\u3068\u3044\u3046\u6bd4\u8f03\u304c\u884c\u3048\u305f\u308a\u3001box\u306e\u4e2d\u5fc3\u70b9\u306e\u8ddd\u96e2\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u3067\u3001\u300c\u3069\u306e\u304f\u3089\u3044\u4f3c\u3066\u3044\u308b\u304b\uff1f\u300d\u306e\u6307\u6a19\u304c\u5f97\u3089\u308c\u305f\u308a\u3059\u308b\u306e\u3067\u3001\u7c21\u5358\u306a\u30ec\u30b3\u30e1\u30f3\u30c9\u3084\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u306a\u3069\u3092\u884c\u3044\u305f\u3044\u3068\u304d\u306b\u3001\u4f7f\u3063\u3066\u307f\u308b\u3068\u9762\u767d\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL\u306b\u306f\u8c4a\u5bcc\u306a\u5e7e\u4f55\u30c7\u30fc\u30bf\u578b\u3068\u5e7e\u4f55\u30c7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2557,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-2556","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=2556"}],"version-history":[{"count":0,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2556\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/2557"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=2556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=2556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=2556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}