{"id":3260,"date":"2025-12-18T18:19:34","date_gmt":"2025-12-18T09:19:34","guid":{"rendered":"https:\/\/www.agile-software.site\/?p=3260"},"modified":"2025-12-19T09:22:53","modified_gmt":"2025-12-19T00:22:53","slug":"snowflake%e3%81%ab%e3%81%8a%e3%81%91%e3%82%8b%e9%96%a2%e6%95%b0","status":"publish","type":"post","link":"https:\/\/agile-software.net\/?p=3260","title":{"rendered":"Snowflake\u306b\u304a\u3051\u308b\u95a2\u6570"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">1. \u30b9\u30ab\u30e9\u30fc\u95a2\u6570 (Scalar Functions)<\/h3>\n\n\n\n<p>\u30b9\u30ab\u30e9\u30fc\u95a2\u6570\u3068\u306f\u3001\u300c1\u3064\u306e\u5165\u529b\uff08\u307e\u305f\u306f1\u884c\u306e\u30c7\u30fc\u30bf\uff09\u306b\u5bfe\u3057\u3066\u30011\u3064\u306e\u5024\u3092\u8fd4\u3059\u300d\u95a2\u6570\u306e\u7dcf\u79f0\u3067\u3059\u3002<br>\u300c\u30b9\u30ab\u30e9\u30fc\uff08Scalar\uff09\u300d\u3068\u3044\u3046\u8a00\u8449\u306b\u306f\u300c\u5358\u4e00\u306e\u300d\u3068\u3044\u3046\u610f\u5473\u304c\u3042\u308a\u307e\u3059\u3002\u5148\u307b\u3069\u7d39\u4ecb\u3057\u305f <code>IFF<\/code>\u3001<code>LPAD<\/code>\u3001\u5f8c\u8ff0\u3059\u308b <code>CONCAT<\/code> \u306a\u3069\u3082\u3001\u3059\u3079\u3066\u3053\u306e\u300c\u30b9\u30ab\u30e9\u30fc\u95a2\u6570\u300d\u3068\u3044\u3046\u5927\u304d\u306a\u30ab\u30c6\u30b4\u30ea\u30fc\u306b\u542b\u307e\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">IFF\u95a2\u6570<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7279\u5fb4:<\/strong> \u5f15\u6570\uff08\u30ab\u30c3\u30b3\u306e\u4e2d\uff09\u304c\u4e0d\u8981\u306a\u3082\u306e\u304c\u591a\u3044\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u4ee3\u8868\u4f8b:<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>CURRENT_ROLE()<\/code>: \u73fe\u5728\u4f7f\u7528\u3057\u3066\u3044\u308b\u30ed\u30fc\u30eb\u540d\u3002<\/li>\n\n\n\n<li><code>CURRENT_WAREHOUSE()<\/code>: \u4f7f\u7528\u4e2d\u306e\u4eee\u60f3\u30a6\u30a7\u30a2\u30cf\u30a6\u30b9\u540d\u3002<\/li>\n\n\n\n<li><code>CURRENT_TIMESTAMP()<\/code>: \u73fe\u5728\u306e\u65e5\u6642\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">5. LPAD\u95a2\u6570<\/h4>\n\n\n\n<p>\u6587\u5b57\u5217\u306e\u5de6\u5074\u3092\u7279\u5b9a\u306e\u6587\u5b57\u3067\u57cb\u3081\u3066\u3001<strong>\u6307\u5b9a\u3057\u305f\u9577\u3055\u306b\u3059\u308b<\/strong>\u95a2\u6570\u3067\u3059\uff08Left Pad\uff09\u3002<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h3 class=\"wp-block-heading\">\u5b9f\u884c\u524d<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><\/td><td>p_partkey<\/td><\/tr><tr><td>1<\/td><td>3<\/td><\/tr><tr><td>2<\/td><td>149<\/td><\/tr><tr><td>3<\/td><td>73155<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h3 class=\"wp-block-heading\">\u5b9f\u884c\u5f8c<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><\/td><td>p_partkey<\/td><\/tr><tr><td>1<\/td><td>0000000003<\/td><\/tr><tr><td>2<\/td><td>0000000149<\/td><\/tr><tr><td>3<\/td><td>0000073155<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n<\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u69cb\u6587:<\/strong> <code>LPAD(\u5143\u306e\u6587\u5b57\u5217, \u5168\u4f53\u306e\u9577\u3055, \u57cb\u3081\u308b\u6587\u5b57)<\/code><\/li>\n\n\n\n<li><strong>\u4f8b:<\/strong> \u5546\u54c1\u30b3\u30fc\u30c9\u306a\u3069\u30925\u6841\u306b\u63c3\u3048\u305f\u3044\u6642\n<ul class=\"wp-block-list\">\n<li><code>LPAD('123', 5, '0')<\/code> \u2192 \u7d50\u679c: <code>'00123'<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5bfe\u7fa9\u8a9e:<\/strong> \u53f3\u5074\u3092\u57cb\u3081\u308b <code>RPAD<\/code> \u3082\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u30c6\u30fc\u30d6\u30eb\u95a2\u6570 (Table Functions)<\/h3>\n\n\n\n<p>\u901a\u5e38\u306e\u95a2\u6570\u304c\u300c1\u3064\u306e\u5024\uff08\u30b9\u30ab\u30e9\u30fc\uff09\u300d\u3092\u8fd4\u3059\u306e\u306b\u5bfe\u3057\u3001<strong>\u300c\u8868\uff08\u8907\u6570\u884c\u30fb\u8907\u6570\u5217\uff09\u300d\u3092\u7d50\u679c\u3068\u3057\u3066\u8fd4\u3059<\/strong>\u95a2\u6570\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7279\u5fb4:<\/strong> <code>FROM<\/code> \u53e5\u306e\u4e2d\u3067 <code>TABLE()<\/code> \u3068\u3044\u3046\u30ad\u30fc\u30ef\u30fc\u30c9\u3068\u4e00\u7dd2\u306b\u4f7f\u308f\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u4ee3\u8868\u4f8b:<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>FLATTEN<\/code>: JSON\u306a\u3069\u306e\u534a\u69cb\u9020\u5316\u30c7\u30fc\u30bf\u3092\u30d0\u30e9\u3057\u3066\u884c\u306b\u5c55\u958b\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>RESULT_SCAN<\/code>: \u76f4\u524d\u306b\u5b9f\u884c\u3057\u305f\u30af\u30a8\u30ea\u306e\u7d50\u679c\u3092\u30c6\u30fc\u30d6\u30eb\u3068\u3057\u3066\u8aad\u307f\u8fbc\u3080\u3002<\/li>\n\n\n\n<li><code>SPLIT_TO_TABLE<\/code>: \u6587\u5b57\u5217\u3092\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u5272\u3057\u3066\u884c\u306b\u3059\u308b\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u30a6\u30a3\u30f3\u30c9\u30a6\u95a2\u6570 (Window Functions)<\/h3>\n\n\n\n<p>\u884c\u3068\u884c\u306e\u300c\u95a2\u4fc2\u6027\u300d\u3092\u8a08\u7b97\u3059\u308b\u305f\u3081\u306e\u95a2\u6570\u3067\u3059\u3002\u30c6\u30fc\u30d6\u30eb\u5168\u4f53\u3092\u96c6\u8a08\u3057\u30661\u884c\u306b\u307e\u3068\u3081\u308b\u306e\u3067\u306f\u306a\u304f\u3001<strong>\u5404\u884c\u3092\u7dad\u6301\u3057\u305f\u307e\u307e\u3001\u5468\u56f2\u306e\u30c7\u30fc\u30bf\u306b\u57fa\u3065\u3044\u305f\u8a08\u7b97\u7d50\u679c\u3092\u4ed8\u4e0e<\/strong>\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u69cb\u6587:<\/strong> <code>OVER (PARTITION BY ... ORDER BY ...)<\/code> \u3092\u4f34\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u4ee3\u8868\u4f8b:<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>RANK()<\/code> \/ <code>ROW_NUMBER()<\/code>: \u9806\u4f4d\u3084\u884c\u756a\u53f7\u3092\u3064\u3051\u308b\u3002<\/li>\n\n\n\n<li><code>SUM(sales) OVER(...)<\/code>: \u7d2f\u8a08\u58f2\u4e0a\u3092\u51fa\u3059\u3002<\/li>\n\n\n\n<li><code>LAG()<\/code> \/ <code>LEAD()<\/code>: 1\u884c\u524d\u30841\u884c\u5f8c\u306e\u5024\u3092\u53d6\u5f97\u3059\u308b\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u95a2\u6570 (Context Functions)<\/h3>\n\n\n\n<p>\u300c\u4eca\u3001\u8ab0\u304c\u3001\u3069\u306e\u74b0\u5883\u3067\u5b9f\u884c\u3057\u3066\u3044\u308b\u304b\u300d\u3068\u3044\u3046\u3001**\u73fe\u5728\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u72b6\u614b\uff08\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\uff09**\u3092\u8fd4\u3059\u95a2\u6570\u3067\u3059\u3002<\/p>\n\n\n\n<p>Snowflake\u7279\u6709\u306e\u4fbf\u5229\u306a\u95a2\u6570\u3067\u3001\u300c\u7c21\u7565\u7248\u306eIF-THEN-ELSE\u300d\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u69cb\u6587:<\/strong> <code>IFF(\u6761\u4ef6, \u771f\u306e\u5834\u5408\u306e\u5024, \u507d\u306e\u5834\u5408\u306e\u5024)<\/code><\/li>\n\n\n\n<li><strong>\u30e1\u30ea\u30c3\u30c8:<\/strong> \u6a19\u6e96SQL\u306e <code>CASE WHEN...<\/code> \u3088\u308a\u3082\u77ed\u304f\u66f8\u3051\u307e\u3059\u3002\n<ul class=\"wp-block-list\">\n<li>\u4f8b: <code>IFF(score &gt;= 80, '\u5408\u683c', '\u4e0d\u5408\u683c')<\/code><\/li>\n\n\n\n<li>\uff08Excel\u306eIF\u95a2\u6570\u3068\u540c\u3058\u611f\u899a\u3067\u4f7f\u3048\u307e\u3059\uff09<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">6. \u96c6\u8a08\u95a2\u6570 (Aggregate Functions)<\/h3>\n\n\n\n<p>\u8907\u6570\u306e\u884c\u3092\u307e\u3068\u3081\u3066\u3001<strong>1\u3064\u306e\u7d71\u8a08\u7684\u306a\u5024<\/strong>\u3092\u51fa\u3059\u95a2\u6570\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7279\u5fb4:<\/strong> <code>GROUP BY<\/code> \u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u308f\u308c\u308b\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u4ee3\u8868\u4f8b:<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>COUNT()<\/code>: \u884c\u6570\u3092\u6570\u3048\u308b\u3002<\/li>\n\n\n\n<li><code>SUM()<\/code>: \u5408\u8a08\u3092\u51fa\u3059\u3002<\/li>\n\n\n\n<li><code>AVG()<\/code>: \u5e73\u5747\u3092\u51fa\u3059\u3002<\/li>\n\n\n\n<li><code>LISTAGG()<\/code>: \u8907\u6570\u306e\u884c\u306b\u3042\u308b\u6587\u5b57\u5217\u3092\u30ab\u30f3\u30de\u306a\u3069\u3067\u7e4b\u3052\u30661\u3064\u306e\u6587\u5b57\u5217\u306b\u3059\u308b\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">TRUNC\u95a2\u6570<\/h3>\n\n\n\n<p><code>TRUNC<\/code>\uff08\u30c8\u30e9\u30f3\u30af\uff09\u306f\u3001\u300c\u5207\u308a\u6368\u3066\uff08Truncate\uff09\u300d\u3092\u884c\u3046\u95a2\u6570\u3067\u3059\u3002\u65e5\u4ed8\u3084\u6570\u5024\u306b\u5bfe\u3057\u3066\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u65e5\u4ed8\u306b\u4f7f\u3046\u5834\u5408\uff08\u4e00\u756a\u591a\u3044\u30d1\u30bf\u30fc\u30f3\uff09<\/h4>\n\n\n\n<p>\u6642\u523b\u306e\u60c5\u5831\uff08\u6642\u30fb\u5206\u30fb\u79d2\uff09\u3092\u5207\u308a\u6368\u3066\u3066\u3001\u300c\u65e5\u4ed8\u306e\u307f\u300d\u306e\u72b6\u614b\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>TRUNC(2023-10-01 15:30:45)<\/code> \u2192 <strong><code>2023-10-01 00:00:00<\/code><\/strong><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">\u6570\u5024\u306b\u4f7f\u3046\u5834\u5408<\/h4>\n\n\n\n<p>\u6307\u5b9a\u3057\u305f\u6841\u6570\u3067\u5207\u308a\u6368\u3066\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>TRUNC(123.456, 1)<\/code> \u2192 <strong><code>123.4<\/code><\/strong><\/li>\n\n\n\n<li><code>TRUNC(123.456, 0)<\/code> \u2192 <strong><code>123<\/code><\/strong><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">SQL\u3067\u306e\u5177\u4f53\u4f8b<\/h4>\n\n\n\n<p>\u300c2023\u5e7410\u67081\u65e5\u306e\u30c7\u30fc\u30bf\u3060\u3051\u6b32\u3057\u3044\u300d\u3068\u3044\u3046\u6642\u3001\u3064\u3044\u3064\u3044 <code>TRUNC<\/code> \u3092\u4f7f\u3044\u305f\u304f\u306a\u308a\u307e\u3059\u304c\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u5dee\u306f\u6b74\u7136\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>\u66f8\u304d\u65b9<\/strong><\/td><td><strong>SQL\u30a4\u30e1\u30fc\u30b8<\/strong><\/td><td><strong>DB\u306e\u4f5c\u696d<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>&#x274c; \u60aa\u3044\u4f8b (\u95a2\u6570\u5229\u7528)<\/strong><\/td><td><code>WHERE TRUNC(created_at) = '2023-10-01'<\/code><\/td><td>100\u4e07\u4ef6\u3042\u308c\u3070\u3001100\u4e07\u56de\u5207\u308a\u6368\u3066\u8a08\u7b97\u3092\u3057\u3066\u6bd4\u8f03\u3059\u308b<\/td><\/tr><tr><td><strong>&#x2b55; \u826f\u3044\u4f8b (\u7bc4\u56f2\u6307\u5b9a)<\/strong><\/td><td><code>WHERE created_at &gt;= '2023-10-01'<\/code><br><code>AND created_at &lt; '2023-10-02'<\/code><\/td><td>\u7d22\u5f15\u304b\u3089\u300c2023-10-01\u300d\u306e\u5834\u6240\u3092\u30b5\u30c3\u3068\u898b\u3064\u3051\u3066\u3001\u305d\u3053\u3060\u3051\u8aad\u307f\u53d6\u308b<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u95a2\u6570<\/h2>\n\n\n\n<p>Snowflake\u306b\u306f\u4fbf\u5229\u306a\u6a19\u6e96\u95a2\u6570\u304c\u305f\u304f\u3055\u3093\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u300c\u81ea\u5206\u306e\u30d3\u30b8\u30cd\u30b9\u7279\u6709\u306e\u8a08\u7b97\u300d\u3084\u300c\u8907\u96d1\u306a\u30ed\u30b8\u30c3\u30af\u306e\u4f7f\u3044\u56de\u3057\u300d\u304c\u5fc5\u8981\u306b\u306a\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3088\u306d\u3002<\/p>\n\n\n\n<p>\u305d\u3093\u306a\u6642\u306b\u5f79\u7acb\u3064\u306e\u304c**\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u95a2\u6570\uff08UDF\uff09**\u3067\u3059\u3002\u4eca\u56de\u306f\u3001UDF\u306e\u57fa\u790e\u304b\u3089\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6700\u5927\u5316\u3059\u308b\u4f7f\u3044\u5206\u3051\u307e\u3067\u3092\u5fb9\u5e95\u89e3\u8aac\u3057\u307e\u3059\uff01<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u95a2\u6570\uff08UDF\uff09\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>UDF\uff08User-Defined Functions\uff09\u3068\u306f\u3001<strong>\u30e6\u30fc\u30b6\u30fc\u304c\u72ec\u81ea\u306b\u4f5c\u6210\u3067\u304d\u308b\u30ab\u30b9\u30bf\u30e0\u95a2\u6570<\/strong>\u306e\u3053\u3068\u3067\u3059\u3002\u4e00\u5ea6\u4f5c\u6210\u3059\u308c\u3070\u3001\u6a19\u6e96\u306e <code>SUM()<\/code> \u3084 <code>UPPER()<\/code> \u3068\u540c\u3058\u3088\u3046\u306b\u3001SQL\u30af\u30a8\u30ea\u306e\u4e2d\u3067\u81ea\u7531\u306b\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u306a\u305cUDF\u3092\u4f7f\u3046\u306e\u304b\uff1f<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30ed\u30b8\u30c3\u30af\u306e\u518d\u5229\u7528<\/strong>: \u540c\u3058\u8a08\u7b97\u5f0f\u3092\u4f55\u5ea6\u3082\u66f8\u304f\u5fc5\u8981\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30af\u30a8\u30ea\u306e\u7c21\u7d20\u5316<\/strong>: \u6570\u5341\u884c\u306b\u308f\u305f\u308b\u8907\u96d1\u306a <code>CASE<\/code> \u6587\u3092\u30011\u3064\u306e\u95a2\u6570\u306b\u30b9\u30c3\u30ad\u30ea\u307e\u3068\u3081\u3089\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u4ed6\u8a00\u8a9e\u306e\u6d3b\u7528<\/strong>: SQL\u3067\u306f\u96e3\u3057\u3044\u51e6\u7406\u3092\u3001Python\u3084JavaScript\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u3066\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. UDF\u306e2\u3064\u306e\u300c\u623b\u308a\u5024\u300d\u306b\u3088\u308b\u5206\u985e<\/h2>\n\n\n\n<p>UDF\u306b\u306f\u3001\u7d50\u679c\u3092\u3069\u3046\u8fd4\u3059\u304b\u306b\u3088\u3063\u30662\u3064\u306e\u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u2460 \u30b9\u30ab\u30e9\u30fcUDF (Scalar UDFs)<\/h3>\n\n\n\n<p>1\u3064\u306e\u5165\u529b\u306b\u5bfe\u3057\u3066\u3001<strong>1\u3064\u306e\u5024<\/strong>\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4f8b<\/strong>: \u7a0e\u8fbc\u307f\u91d1\u984d\u306e\u8a08\u7b97\u3001\u6587\u5b57\u5217\u306e\u7279\u5b9a\u306e\u6574\u5f62\u306a\u3069\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u2461 \u30c6\u30fc\u30d6\u30ebUDF (UDTFs: User-Defined Table Functions)<\/h3>\n\n\n\n<p>1\u3064\u306e\u5165\u529b\u306b\u5bfe\u3057\u3066\u3001**\u8868\uff08\u8907\u6570\u884c\u30fb\u8907\u6570\u5217\uff09**\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4f8b<\/strong>: 1\u3064\u306e\u6587\u7ae0\u3092\u5358\u8a9e\u3054\u3068\u306b\u30d0\u30e9\u3057\u3066\u884c\u306b\u3059\u308b\u3001\u65e5\u4ed8\u7bc4\u56f2\u304b\u3089\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u751f\u6210\u3059\u308b\u306a\u3069\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. UDF\u3067\u4f7f\u3048\u308b4\u3064\u306e\u8a00\u8a9e<\/h2>\n\n\n\n<p>Snowflake\u306eUDF\u306f\u3001SQL\u3060\u3051\u3067\u306a\u304f\u8907\u6570\u306e\u8a00\u8a9e\u3067\u8a18\u8ff0\u3067\u304d\u308b\u306e\u304c\u5927\u304d\u306a\u7279\u5fb4\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>\u8a00\u8a9e<\/strong><\/td><td><strong>\u7279\u5fb4<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>SQL<\/strong><\/td><td>\u6700\u3082\u30b7\u30f3\u30d7\u30eb\u3067\u9ad8\u901f\u3002\u7c21\u5358\u306a\u8a08\u7b97\u3084\u30ed\u30b8\u30c3\u30af\u5411\u304d\u3002<\/td><\/tr><tr><td><strong>Python<\/strong><\/td><td>\u8c4a\u5bcc\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\uff08Pandas\u306a\u3069\uff09\u304c\u5229\u7528\u53ef\u80fd\u3002\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u5411\u304d\u3002<\/td><\/tr><tr><td><strong>JavaScript<\/strong><\/td><td>\u8907\u96d1\u306a\u6761\u4ef6\u5206\u5c90\u3084\u3001\u52d5\u7684\u306a\u30ed\u30b8\u30c3\u30af\u304c\u5f97\u610f\u3002<\/td><\/tr><tr><td><strong>Java \/ Scala<\/strong><\/td><td>\u65e2\u5b58\u306e\u30a8\u30f3\u30bf\u30fc\u30d7\u30e9\u30a4\u30ba\u8cc7\u7523\u306e\u79fb\u884c\u3084\u3001\u9ad8\u5ea6\u306a\u8a08\u7b97\u5411\u304d\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">RETURNS TABLE (\u2026)<\/h4>\n\n\n\n<p>\u666e\u901a\u306e\u95a2\u6570\uff08\u30b9\u30ab\u30e9\u30fc\u95a2\u6570\uff09\u306f\u300c100\u300d\u3084\u300c&#8217;SUCCESS&#8217;\u300d\u3068\u3044\u3063\u305f1\u3064\u306e\u5024\u3092\u8fd4\u3057\u307e\u3059\u304c\u3001\u3053\u306e\u95a2\u6570\u306f\u6307\u5b9a\u3057\u305f\u5217\u69cb\u6210\u3092\u6301\u3064\u300c\u8868\u305d\u306e\u3082\u306e\u300d\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>RETURNS TABLE (customer_id number, first_name varchar, last_name varchar, region varchar, nation varchar)<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">\u5f15\u6570<\/h4>\n\n\n\n<p><code>( )<\/code> \u306e\u4e2d\u306b\u3042\u308b <code>region_nation<\/code> \u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b\u3059\u308b\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u3059\u3002 \u3053\u306e\u95a2\u6570\u306f\u8ce2\u3044\u4f5c\u308a\u306b\u306a\u3063\u3066\u304a\u308a\u3001<strong>\u300c\u56fd\u540d\uff08NATION\uff09\u300d\u3092\u5165\u308c\u3066\u3082\u300c\u5730\u57df\u540d\uff08REGION\uff09\u300d\u3092\u5165\u308c\u3066\u3082\u3001\u3069\u3061\u3089\u3067\u3082\u53cd\u5fdc\u3059\u308b\u3088\u3046\u306b\u8a2d\u8a08\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>FUNCTION get_customers_by_nation_region ( region_nation varchar )<\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">\u547c\u3073\u51fa\u3057\u65b9<\/h4>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>-- \u300cAMERICA\u300d\u5730\u57df\u306e\u9867\u5ba2\u3092\u3059\u3079\u3066\u53d6\u5f97\u3059\u308b\u5834\u5408\nSELECT * FROM TABLE(get_customers_by_nation_region(&#39;AMERICA&#39;));\n\n-- \u300cFRANCE\u300d\u56fd\u306e\u9867\u5ba2\u3092\u3059\u3079\u3066\u53d6\u5f97\u3059\u308b\u5834\u5408\nSELECT * FROM TABLE(get_customers_by_nation_region(&#39;FRANCE&#39;));<\/code><\/pre><\/div>\n\n\n\n<p><strong>\u8907\u96d1\u306aJOIN\u306e\u96a0\u853d<\/strong>: \u672c\u6765\u306a\u3089\u6bce\u56de3\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3092JOIN\u3057\u3066 <code>WHERE<\/code> \u3092\u66f8\u304b\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u304c\u3001\u3053\u306e\u95a2\u6570\u3092\u4f7f\u3048\u3070 <code>SELECT * FROM TABLE(\u95a2\u6570\u540d('\u30ad\u30fc\u30ef\u30fc\u30c9'))<\/code> \u3060\u3051\u3067\u6e08\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u67d4\u8edf\u6027<\/strong>: \u300c\u56fd\u300d\u304b\u300c\u5730\u57df\u300d\u304b\u3092\u6c17\u306b\u305b\u305a\u30011\u3064\u306e\u5165\u529b\u6b04\uff08\u5f15\u6570\uff09\u3067\u691c\u7d22\u3067\u304d\u308b\u305f\u3081\u3001BI\u30c4\u30fc\u30eb\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u547c\u3073\u51fa\u3059\u969b\u306b\u975e\u5e38\u306b\u4fbf\u5229\u3067\u3059\u3002<\/p>\n\n\n\n<p><strong>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3<\/strong>: \u3053\u306e\u95a2\u6570\u3092\u300c\u30bb\u30ad\u30e5\u30a2\uff08SECURE\uff09\u300d\u306b\u8a2d\u5b9a\u3059\u308c\u3070\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u5bfe\u3057\u3066<strong>\u5143\u306e\u57fa\u76e4\u30c6\u30fc\u30d6\u30eb\uff08CUSTOMER\u7b49\uff09\u3078\u306e\u76f4\u63a5\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u3053\u3068\u306a\u304f\u3001\u7279\u5b9a\u306e\u30d5\u30a3\u30eb\u30bf\u7d50\u679c\u3060\u3051\u3092\u516c\u958b\u3059\u308b<\/strong>\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code><\/code><\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><\/h4>\n\n\n\n<p>\u7279\u5b9a\u306e\u9867\u5ba2\uff08customer_id\uff09\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u305d\u306e\u4eba\u304c\u904e\u53bb\u306b\u884c\u3063\u305f\u6ce8\u6587\u306e\u4e2d\u304b\u3089\u3001\u5408\u8a08\u91d1\u984d\u304c\u9ad8\u3044\u4e0a\u4f4d10\u4ef6\u3092\u8a08\u7b97\u3057\u3066\u30ea\u30b9\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u300d<br><strong>\u5f79\u5272<\/strong>: \u8907\u96d1\u306a\u58f2\u4e0a\u8a08\u7b97\uff08\u5358\u4fa1 \u00d7 \u6570\u91cf \uff0d \u5272\u5f15 \uff0b \u7a0e\uff09\u3092\u88cf\u5074\u3067\u884c\u3044\u3001\u7d50\u679c\u3092\u300c\u6ce8\u6587ID\u3001\u65e5\u4ed8\u3001\u7dcf\u984d\u300d\u3068\u3044\u3046\u4f7f\u3044\u3084\u3059\u3044\u8868\u306e\u5f62\u3067\u8fd4\u3057\u307e\u3059\u3002<br><strong>\u5f15\u6570 (<code>customer_id<\/code>)<\/strong>: \u9867\u5ba2\u306eID\uff08\u6570\u5024\uff09\u30921\u3064\u6e21\u3059\u3060\u3051\u3067\u3001\u305d\u306e\u4eba\u5c02\u7528\u306e\u30e9\u30f3\u30ad\u30f3\u30b0\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8907\u96d1\u306a\u8a08\u7b97\u5f0f\uff08net_line_item_total\uff09<\/h3>\n\n\n\n<p>\u95a2\u6570\u306e\u4e2d\u5fc3\u306b\u3042\u308b\u4ee5\u4e0b\u306e\u8a08\u7b97\u5f0f\u306f\u3001\u30d3\u30b8\u30cd\u30b9\u306b\u304a\u3051\u308b\u300c\u771f\u306e\u58f2\u4e0a\u984d\u300d\u3092\u7b97\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>(SUM(L_QUANTITY * P_RETAILPRICE * (1-L_DISCOUNT) * (1+L_TAX)))::NUMBER(18,2)<\/code><\/pre><\/div>\n\n\n\n<p><strong>\u8a08\u7b97\u306e\u9806\u5e8f<\/strong>:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><code>L_QUANTITY * P_RETAILPRICE<\/code>: \u6570\u91cf \u00d7 \u5358\u4fa1 \u3067\u57fa\u672c\u984d\u3092\u51fa\u3059\u3002<\/li>\n\n\n\n<li><code>* (1-L_DISCOUNT)<\/code>: \u305d\u3053\u304b\u3089\u5272\u5f15\u5206\u3092\u5f15\u304f\uff08\u4f8b\uff1a\u5272\u5f15\u73870.1\u306a\u30890.9\u3092\u304b\u3051\u308b\uff09\u3002<\/li>\n\n\n\n<li><code>* (1+L_TAX)<\/code>: \u3055\u3089\u306b\u7a0e\u91d1\u3092\u52a0\u7b97\u3059\u308b\uff08\u4f8b\uff1a\u7a0e\u73870.1\u306a\u30891.1\u3092\u304b\u3051\u308b\uff09\u3002<\/li>\n\n\n\n<li><code>SUM(...)<\/code>: 1\u3064\u306e\u6ce8\u6587\u306b\u306f\u8907\u6570\u306e\u5546\u54c1\uff08\u660e\u7d30\uff09\u304c\u542b\u307e\u308c\u308b\u305f\u3081\u3001\u305d\u308c\u3089\u3092\u5408\u8a08\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>::NUMBER(18,2)<\/code>: \u6700\u5f8c\u306b\u5c0f\u6570\u70b9\u7b2c2\u4f4d\u307e\u3067\u306e\u6570\u5024\u578b\u306b\u6574\u5f62\u3059\u308b\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u6761\u4ef6\u7d5e\u308a\u8fbc\u307f\uff08WHERE\u53e5\uff09\u306e\u91cd\u8981\u6027<\/h3>\n\n\n\n<p>\u89e3\u8aac\u6587\u306b\u3082\u3042\u308b\u901a\u308a\u3001\u8fd4\u54c1\u3055\u308c\u305f\u5546\u54c1\u3092\u9664\u5916\u3057\u3066\u3044\u307e\u3059\u3002<br><strong>\u610f\u5473<\/strong>: \u8fd4\u54c1\u6e08\u307f\u30d5\u30e9\u30b0\uff08&#8217;R&#8217;\uff09\u304c\u7acb\u3063\u3066\u3044\u308b\u3082\u306e\u306f\u3001\u58f2\u4e0a\u306b\u8a08\u4e0a\u3057\u3066\u306f\u3044\u3051\u306a\u3044\u306e\u3067\u9664\u5916\u3057\u307e\u3059\u3002<br><strong>\u7d50\u679c<\/strong>: \u300c\u5b9f\u969b\u306b\u8cfc\u5165\u304c\u78ba\u5b9a\u3057\u305f\u6709\u52b9\u306a\u6ce8\u6587\u300d\u306e\u307f\u3092\u5bfe\u8c61\u3068\u3057\u305f\u3001\u6b63\u78ba\u306a\u30e9\u30f3\u30ad\u30f3\u30b0\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>WHERE L_RETURNFLAG &lt;&gt; &#39;R&#39;<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e0a\u4f4d10\u4ef6\u306e\u62bd\u51fa\uff08TOP 10 \u3068 ORDER BY\uff09<\/h3>\n\n\n\n<p><code>ORDER BY ... DESC<\/code>: \u8a08\u7b97\u3057\u305f\u6ce8\u6587\u7dcf\u984d\u304c\u9ad8\u3044\u9806\uff08\u964d\u9806\uff09\u306b\u4e26\u3079\u66ff\u3048\u307e\u3059\u3002<br><code>TOP 10<\/code>: \u4e26\u3079\u66ff\u3048\u305f\u7d50\u679c\u306e\u5148\u982d10\u884c\u3060\u3051\u3092\u5207\u308a\u51fa\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>SELECT TOP 10 ... ORDER BY net_line_item_total DESC<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f7f\u3044\u65b9\uff08\u547c\u3073\u51fa\u3057\u4f8b\uff09<\/h3>\n\n\n\n<p>Noah Yamada\u3055\u3093\u306e\u9867\u5ba2ID\u304c <code>12345<\/code> \u3060\u3063\u305f\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>-- Noah Yamada\u306e\u4e0a\u4f4d10\u4ef6\u306e\u6ce8\u6587\u3092\u8868\u793a\nSELECT * FROM TABLE(fetch_top_ten_orders(12345));<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<p>\u300c\u30b9\u30ab\u30e9\u30fcSQL UDF\uff08\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u95a2\u6570\uff09\u300d\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5148\u307b\u3069\u307e\u3067\u306e\u300c\u30c6\u30fc\u30d6\u30eb\u95a2\u6570\uff08UDTF\uff09\u300d\u304c\u300c\u8868\u300d\u3092\u8fd4\u3057\u3066\u3044\u305f\u306e\u306b\u5bfe\u3057\u3001\u3053\u306e\u95a2\u6570\u306f\u300c1\u884c\u306e\u30c7\u30fc\u30bf\u304b\u30891\u3064\u306e\u8a08\u7b97\u7d50\u679c\u300d\u3060\u3051\u3092\u8fd4\u3057\u307e\u3059\u3002Excel\u306e\u6570\u5f0f\u3092\u95a2\u6570\u3068\u3057\u3066\u767b\u9332\u3059\u308b\u3088\u3046\u306a\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u3092\u6574\u7406\u3057\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u3053\u306e\u95a2\u6570\u306e\u5f79\u5272\uff1a\u8a08\u7b97\u5f0f\u306e\u300c\u90e8\u54c1\u5316\u300d<\/h2>\n\n\n\n<p>\u3053\u306e\u95a2\u6570 <code>fetch_net_line_item_total<\/code> \u306f\u3001\u30d3\u30b8\u30cd\u30b9\u3067\u983b\u7e41\u306b\u4f7f\u3046\u300c\u6b63\u5473\u306e\u58f2\u4e0a\u91d1\u984d\uff08\u7a0e\u30fb\u5272\u5f15\u8fbc\u307f\uff09\u300d\u306e\u8a08\u7b97\u30ed\u30b8\u30c3\u30af\u3092\u4e00\u7b87\u6240\u306b\u307e\u3068\u3081\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5165\u529b<\/strong>: \u6570\u91cf\u3001\u5c0f\u58f2\u4fa1\u683c\u3001\u5272\u5f15\u7387\u3001\u7a0e\u7387\u306e4\u3064\u3002<\/li>\n\n\n\n<li><strong>\u51fa\u529b<\/strong>: \u8a08\u7b97\u5f8c\u306e\u300c\u91d1\u984d\uff081\u3064\u306e\u6570\u5024\uff09\u300d\u3060\u3051\u3092\u8fd4\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u30c6\u30fc\u30d6\u30eb\u95a2\u6570\uff08UDTF\uff09\u3068\u306e\u9055\u3044<\/h2>\n\n\n\n<p>\u89e3\u8aac\u6587\u306b\u3042\u308b\u901a\u308a\u3001\u69cb\u9020\u306f\u4f3c\u3066\u3044\u307e\u3059\u304c\u6c7a\u5b9a\u7684\u306a\u9055\u3044\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td><strong>\u7279\u5fb4<\/strong><\/td><td><strong>\u30c6\u30fc\u30d6\u30eb\u95a2\u6570 (UDTF)<\/strong><\/td><td><strong>\u30b9\u30ab\u30e9\u30fc\u95a2\u6570 (UDF)<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>\u623b\u308a\u5024\u306e\u5b9a\u7fa9<\/strong><\/td><td><code>RETURNS TABLE (...)<\/code><\/td><td><strong><code>RETURNS number(18,2)<\/code><\/strong><\/td><\/tr><tr><td><strong>\u623b\u3063\u3066\u304f\u308b\u3082\u306e<\/strong><\/td><td>\u8907\u6570\u884c\u30fb\u8907\u6570\u5217\u306e\u300c\u8868\u300d<\/td><td><strong>\u5358\u4e00\u306e\u300c\u5024\u300d<\/strong><\/td><\/tr><tr><td><strong>\u547c\u3073\u51fa\u3057\u5834\u6240<\/strong><\/td><td><code>FROM TABLE(\u95a2\u6570\u540d(...))<\/code><\/td><td><strong><code>SELECT \u95a2\u6570\u540d(...)<\/code><\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u306a\u305c\u308f\u3056\u308f\u3056\u300c\u30b9\u30ab\u30e9\u30fc\u95a2\u6570\u300d\u306b\u3059\u308b\u306e\u304b\uff1f<\/h2>\n\n\n\n<p>\u5148\u307b\u3069\u300c\u4e0a\u4f4d10\u4ef6\u306e\u6ce8\u6587\u3092\u51fa\u3059\u30c6\u30fc\u30d6\u30eb\u95a2\u6570\u300d\u3092\u898b\u307e\u3057\u305f\u304c\u3001\u305d\u306e\u4e2d\u306b\u3082\u540c\u3058\u8a08\u7b97\u5f0f\u304c\u5165\u3063\u3066\u3044\u307e\u3057\u305f\u3088\u306d\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>-- \u30c6\u30fc\u30d6\u30eb\u95a2\u6570\u306e\u4e2d\u306b\u66f8\u3044\u3066\u3042\u3063\u305f\u8a08\u7b97\u5f0f\n(SUM(L_QUANTITY*P_RETAILPRICE*(1-L_DISCOUNT)*(1+L_TAX)))::NUMBER(18,2)<\/code><\/pre><\/div>\n\n\n\n<p>\u3082\u3057\u3053\u306e\u8a08\u7b97\u5f0f\uff08\u4f8b\u3048\u3070\u7a0e\u91d1\u306e\u8a08\u7b97\u30eb\u30fc\u30eb\u306a\u3069\uff09\u304c\u5909\u66f4\u306b\u306a\u3063\u305f\u5834\u5408\u3001\u3042\u3061\u3053\u3061\u306b\u3053\u306e\u5f0f\u3092\u76f4\u66f8\u304d\u3057\u3066\u3044\u308b\u3068\u3001\u3059\u3079\u3066\u306e\u95a2\u6570\u3084\u30af\u30a8\u30ea\u3092\u66f8\u304d\u76f4\u3055\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u3057\u304b\u3057\u3001\u4eca\u56de\u306e\u3088\u3046\u306b<strong>\u30b9\u30ab\u30e9\u30fc\u95a2\u6570\u3068\u3057\u3066\u72ec\u7acb\u3055\u305b\u3066\u304a\u3051\u3070\u3001\u3053\u306e\u95a2\u6570\u306e\u4e2d\u8eab\u30921\u7b87\u6240\u76f4\u3059\u3060\u3051\u3067\u3059\u3079\u3066\u306e\u30af\u30a8\u30ea\u306b\u53cd\u6620\u3055\u308c\u307e\u3059\u3002<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u3044\u65b9\uff08\u547c\u3073\u51fa\u3057\u4f8b\uff09<\/h2>\n\n\n\n<p>\u30b9\u30ab\u30e9\u30fc\u95a2\u6570\u306f\u3001<code>SELECT<\/code> \u53e5\u306e\u4e2d\u3067\u901a\u5e38\u306e\u5217\u3068\u540c\u3058\u3088\u3046\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>SELECT \n    L_ORDERKEY,\n    L_LINENUMBER,\n    -- \u81ea\u4f5c\u3057\u305f\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\n    fetch_net_line_item_total(L_QUANTITY, L_EXTENDEDPRICE, L_DISCOUNT, L_TAX) AS net_total\nFROM \n    SNOWBEARAIR_DB.PROMO_CATALOG_SALES.LINEITEM;<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. \u30b9\u30ab\u30e9\u30fc\u95a2\u6570 (Scalar Functions) \u30b9\u30ab\u30e9\u30fc\u95a2\u6570\u3068\u306f\u3001\u300c1\u3064\u306e\u5165\u529b\uff08\u307e\u305f\u306f1\u884c\u306e\u30c7\u30fc\u30bf\uff09\u306b\u5bfe\u3057\u3066\u30011\u3064\u306e\u5024\u3092\u8fd4\u3059\u300d\u95a2\u6570\u306e\u7dcf\u79f0\u3067\u3059\u3002\u300c\u30b9\u30ab\u30e9\u30fc\uff08Scalar\uff09\u300d\u3068\u3044\u3046\u8a00\u8449\u306b\u306f\u300c\u5358\u4e00\u306e\u300d\u3068\u3044\u3046\u610f\u5473\u304c\u3042\u308a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jin_ogp_image_url":"","_jin_last_featured_id":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3260","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/3260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3260"}],"version-history":[{"count":2,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/3260\/revisions"}],"predecessor-version":[{"id":3263,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/3260\/revisions\/3263"}],"wp:attachment":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}