{"id":12239,"date":"2021-12-01T08:00:23","date_gmt":"2021-12-01T16:00:23","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=12239"},"modified":"2025-06-13T17:20:52","modified_gmt":"2025-06-14T00:20:52","slug":"denormalize-imported-documents-rdbms-to-couchbase-using-n1ql","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/ko\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/","title":{"rendered":"N1QL\uc744 \uc0ac\uc6a9\ud558\uc5ec RDBMS \ud14c\uc774\ube14\uc5d0\uc11c \uac00\uc838\uc628 \ubb38\uc11c\ub97c \ube44\uc815\uaddc\ud654\ud558\ub294 \ubc29\ubc95"},"content":{"rendered":"<p><strong>\ub370\uc774\ud130 \ub9c8\uc774\uadf8\ub808\uc774\uc158\uc740<\/strong> \ub3c4\uc804\uc73c\ub85c \uac00\ub4dd\ud569\ub2c8\ub2e4.<\/p>\n<p>SQL Server\ub098 Oracle\uacfc \uac19\uc740 \uad00\uacc4\ud615 \ub370\uc774\ud130\ubca0\uc774\uc2a4(RDBMS)\uc5d0\uc11c \ub9c8\uc774\uadf8\ub808\uc774\uc158\ud558\ub294 \uacbd\uc6b0, \ub300\uc0c1 \ub370\uc774\ud130 \ubaa8\ub378\uc5d0 \ub530\ub77c \ub9c8\uc774\uadf8\ub808\uc774\uc158\ub41c \ubb38\uc11c\ub97c \ube44\uc815\uaddc\ud654\ud558\ub294 \uac83\uc774 \uac00\uc7a5 \ud070 \uacfc\uc81c\uc785\ub2c8\ub2e4. \uc2a4\ucf54\ud504\uc640 \uceec\ub809\uc158\uc774 \ub3c4\uc785\ub418\uba74\uc11c <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/couchbase-server-7-0-release\/?ref=blog\" target=\"_blank\" rel=\"noopener\">\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \uc11c\ubc84 7.0 \ub9b4\ub9ac\uc988<\/a> \ub97c \uc0ac\uc6a9\ud558\uba74 \ubc84\ud0b7 \ub0b4\uc5d0\uc11c \ubb38\uc11c\ub97c \uc27d\uac8c \ubd84\ub958\ud558\uace0 \uc815\ub9ac\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>SQL Server \ub610\ub294 Oracle\uc5d0\uc11c Couchbase\ub85c \ub370\uc774\ud130\ub97c \ub9c8\uc774\uadf8\ub808\uc774\uc158\ud558\ub294 \ub370 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \uc635\uc158\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li><a href=\"https:\/\/docs.couchbase.com\/server\/current\/tools\/cbimport.html?ref=blog\" target=\"_blank\" rel=\"noopener\">CSV\/JSON\uc744 Couchbase\ub85c \uac00\uc838\uc624\uae30<\/a> using `cbimport`.<\/li>\n<li>\uc0ac\uc6a9\uc790 \uc9c0\uc815 ETL \ucf54\ub4dc\ub97c \uc791\uc131\ud558\uc5ec RDBMS\uc5d0\uc11c Couchbase\ub85c \ub370\uc774\ud130\ub97c \uc774\ub3d9\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>In most of the cases `cbimport` itself is sufficient to complete the data migration from an Oracle or SQL Server database to <a href=\"https:\/\/developer.couchbase.com\/new-to-couchbase\/?ref=blog\" target=\"_blank\" rel=\"noopener\">\uce74\uc6b0\uce58\ubca0\uc774\uc2a4<\/a> because `cbimport` can import documents into a required scope and collection<\/p>\n<p>\uc774 \uae00\uc5d0\uc11c\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \ubc29\ubc95\uc744 \uc0ac\uc6a9\ud558\ub294 \ubc29\ubc95\uc5d0 \ub300\ud574 \uc124\uba85\ud569\ub2c8\ub2e4. <a href=\"https:\/\/query-tutorial.couchbase.com\/tutorial\/?ref=blog\/#1\" target=\"_blank\" rel=\"noopener\">SQL++ \ucffc\ub9ac<\/a> (\uc774\ud558 N1QL\uc774\ub77c\uace0 \ud568)\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubc94\uc704 \ub0b4\uc758 \uc5ec\ub7ec \uceec\ub809\uc158\uc5d0\uc11c \uac00\uc838\uc628 \ubb38\uc11c\ub97c \ubcd1\ud569\/\ud45c\uc900\ud654\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<h2>\ubc30\uacbd \uc815\ubcf4<\/h2>\n<p>\uba3c\uc800, Couchbase Server 7.0\uc5d0\uc11c RDBMS \uc5d4\ud2f0\ud2f0\uc640 \uadf8\uc5d0 \uc0c1\uc751\ud558\ub294 \uc5d4\ud2f0\ud2f0 \uac04\uc758 \uc720\uc0ac\uc810\uc744 \uac80\ud1a0\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>RDBMS \uc5d4\ud2f0\ud2f0<\/strong><\/td>\n<td><strong>\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \ub4f1\uac00\ubb3c<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\ub370\uc774\ud130\ubca0\uc774\uc2a4<\/td>\n<td>\ubc84\ud0b7<\/td>\n<\/tr>\n<tr>\n<td>\uc2a4\ud0a4\ub9c8<\/td>\n<td>\ubc94\uc704<\/td>\n<\/tr>\n<tr>\n<td>\ud45c<\/td>\n<td>\uceec\ub809\uc158<\/td>\n<\/tr>\n<tr>\n<td>\ud589<\/td>\n<td>\ubb38\uc11c<\/td>\n<\/tr>\n<tr>\n<td>\uce7c\ub7fc<\/td>\n<td>\uc18d\uc131<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>RDBMS\uc5d0\uc11c Couchbase\ub85c\uc758 \ub370\uc774\ud130 \ub9c8\uc774\uadf8\ub808\uc774\uc158\uc5d0\ub294 \ub450 \uac00\uc9c0 \ubcc0\ud615\uc774 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4:<\/p>\n<ol>\n<li><strong>\uc77c\ub300\uc77c \ub9e4\ud551:<\/strong> \uac01 RDBMS \ud14c\uc774\ube14\uc744 Couchbase\uc758 \uceec\ub809\uc158\uc73c\ub85c \uac00\uc838\uc624\uba74 \ud574\ub2f9 \ud14c\uc774\ube14\uc758 \uac01 \ud589\uc740 \ub2e4\uc74c\uacfc \uac19\uc774 \ub429\ub2c8\ub2e4. <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/json-database\/?ref=blog\" target=\"_blank\" rel=\"noopener\">JSON \ubb38\uc11c<\/a>. This is the simplest migration as it does not require any denormalization and the whole process can be completed using `cbimport` only.<\/li>\n<li><strong>\ub2e4\ub300\uc77c \ub9e4\ud551:<\/strong> RDBMS \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc758 \uc5ec\ub7ec \ud14c\uc774\ube14\uc744 \ud558\ub098\uc758 Couchbase \ubb38\uc11c\ub85c \uacb0\ud569\ud558\uac70\ub098 \uc815\uaddc\ud654\ub41c RDBMS \ud14c\uc774\ube14\uc744 Couchbase \ubb38\uc11c\ub85c \ube44\uc815\uaddc\ud654\ud55c\ub2e4\uace0 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ube44\uc815\uaddc\ud654\ub97c \ub2ec\uc131\ud558\uae30 \uc704\ud574 \ub2e4\uc74c\uacfc \uac19\uc740 \uc5ec\ub7ec \uac00\uc9c0 \uc635\uc158\uc774 \uc788\uc2b5\ub2c8\ub2e4:\n<ul>\n<li><strong>\uc18c\uc2a4\uc5d0\uc11c \ube44\uc815\uaddc\ud654:<\/strong> This means exporting data from Oracle\/SQL Server in JSON format and the structure of that JSON matches the target Couchbase data model. Then you import that exported JSON document into Couchbase using `cbimport`. However, this isn&#8217;t possible all the time, because you have to work on some complex queries to generate your target data model. Moreover, JSON export is not always supported by all databases.<\/li>\n<li><strong>\uc911\uac04 \ub808\uc774\uc5b4\uc5d0\uc11c\uc758 \ube44\uc815\uaddc\ud654:<\/strong> \uc774\ub294 \uc0ac\uc6a9\uc790 \uc815\uc758 \ucf54\ub4dc(C#, Java \ub4f1\uacfc \uac19\uc740 \ubaa8\ub4e0 \ud504\ub85c\uadf8\ub798\ubc0d \uc5b8\uc5b4)\ub97c \uc0ac\uc6a9\ud558\uc5ec RDBMS\uc5d0\uc11c Couchbase\ub85c \ub370\uc774\ud130\ub97c \uc774\ub3d9\ud558\ub294 \uacbd\uc6b0\uc5d0\ub9cc \uac00\ub2a5\ud569\ub2c8\ub2e4. \uc774\ub807\uac8c \ud558\uba74 \ucf54\ub4dc\uac00 \uc18c\uc2a4 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0 \uc5f0\uacb0\ud558\uace0, \uc18c\uc2a4\uc5d0\uc11c \ub370\uc774\ud130\ub97c \uc77d\uace0, \ub300\uc0c1 Couchbase \ub370\uc774\ud130 \ubaa8\ub378\uc5d0 \ub530\ub77c \ub370\uc774\ud130\ub97c \uc218\uc815\ud55c \ub2e4\uc74c, Couchbase\uc5d0 \ub370\uc774\ud130\ub97c \uc501\ub2c8\ub2e4. \ud558\uc9c0\ub9cc \uac01 \ub300\uc0c1 \ub370\uc774\ud130 \ubaa8\ub378\uc5d0 \ub300\ud55c \ucf54\ub4dc\ub97c \uc791\uc131\ud574\uc57c \ud558\ubbc0\ub85c \ub9ce\uc740 \uac1c\ubc1c \uc791\uc5c5\uc774 \ud544\uc694\ud569\ub2c8\ub2e4.<\/li>\n<li><strong>\ubaa9\uc801\uc9c0\uc5d0\uc11c\uc758 \ube44\uc815\uaddc\ud654:<\/strong> In this option, you move data from RDBMS to Couchbase either using `cbimport` or by other means. Then you write some custom N1QL queries to perform denormalization at the Couchbase level. This is a suitable option in case the target data model has a maximum of three to four levels of child nesting. You can go for this option even if your nesting is more than three or four levels, but that introduces more complexity.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<h2>\uc5f0\uc2b5 \uc608\uc81c: N1QL\uc744 \uc0ac\uc6a9\ud558\uc5ec \ub300\uc0c1\uc5d0\uc11c \ube44\uc815\uaddc\ud654\ub97c \uc0ac\uc6a9\ud558\uc5ec RDBMS\uc5d0\uc11c \uce74\uc6b0\uce58\ubca0\uc774\uc2a4\ub85c \ub370\uc774\ud130 \ub9c8\uc774\uadf8\ub808\uc774\uc158\ud558\uae30<\/h2>\n<p>To demonstrate this migration and denormalization activity, I have created a sample database in SQL Server which contains five tables names: `[Customer]`, `[Address]`, `[Order]`, `[OrderDetails]`, and `[ProductDetails]`. Below is the database diagram to showcase relationships and column details:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/sql-server-ecommerce-database-diagram-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12243\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/sql-server-ecommerce-database-diagram-example.png\" alt=\"An ecommerce database diagram example for Microsoft SQL Server\" width=\"924\" height=\"436\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/sql-server-ecommerce-database-diagram-example.png 924w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/sql-server-ecommerce-database-diagram-example-300x142.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/sql-server-ecommerce-database-diagram-example-768x362.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/sql-server-ecommerce-database-diagram-example-20x9.png 20w\" sizes=\"auto, (max-width: 924px) 100vw, 924px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>\uc544\ub798\ub294 \uac01 \ud14c\uc774\ube14\uc5d0 \ub85c\ub4dc\ub41c \uc0d8\ud50c \ub370\uc774\ud130\uc785\ub2c8\ub2e4:<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"vertical-align: middle\">`select * from [dbo].[Customer]`<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/customer-sample-data-table-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12245\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/customer-sample-data-table-1.png\" alt=\"Customer sample data\" width=\"520\" height=\"180\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/customer-sample-data-table-1.png 520w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/customer-sample-data-table-1-300x104.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/customer-sample-data-table-1-20x7.png 20w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: middle\">`select * from [dbo].[Address]`<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/address-sample-data-table-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12244\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/address-sample-data-table-2.png\" alt=\"Address sample data\" width=\"720\" height=\"290\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/address-sample-data-table-2.png 720w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/address-sample-data-table-2-300x121.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/address-sample-data-table-2-20x8.png 20w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: middle\">`select * from [dbo].[ProductDetails]`<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/product-details-sample-data-table-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12248\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/product-details-sample-data-table-3.png\" alt=\"Product details sample data\" width=\"394\" height=\"150\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/product-details-sample-data-table-3.png 394w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/product-details-sample-data-table-3-300x114.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/product-details-sample-data-table-3-20x8.png 20w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: middle\">`select * from [dbo].[Order]`<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/order-sample-data-table-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12247\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/order-sample-data-table-4.png\" alt=\"Order sample data\" width=\"616\" height=\"212\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/order-sample-data-table-4.png 616w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/order-sample-data-table-4-300x103.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/order-sample-data-table-4-20x7.png 20w\" sizes=\"auto, (max-width: 616px) 100vw, 616px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: middle\">`select * from [dbo].[OrderDetails]`<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/order-details-sample-data-table-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12246\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/order-details-sample-data-table-5.png\" alt=\"Order details sample data\" width=\"780\" height=\"270\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/order-details-sample-data-table-5.png 780w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/order-details-sample-data-table-5-300x104.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/order-details-sample-data-table-5-768x266.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/order-details-sample-data-table-5-20x7.png 20w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><strong>Couchbase 7.0 \uc124\uc815:<\/strong> I have installed Couchbase 7.0 on a Windows machine and my test cluster is ready. I have created one bucket named `testBucket`. Further, I have created a scope named `dbo` corresponding to the RDBMS schema and then created five collections in the `dbo` scope. Here I&#8217;m keeping Collection names the same as the RDBMS table names. However, that&#8217;s not mandatory; scope and collection names can be anything of your choice.<\/p>\n<p>Next, I import all RDBMS tables into this scope (`dbo`) using `cbimport`.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/using-cbimport-data-import-rdbms-to-couchbase.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12256\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/using-cbimport-data-import-rdbms-to-couchbase.png\" alt=\"Using the cbimport tool to import data from RDBMS to Couchbase\" width=\"936\" height=\"366\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/using-cbimport-data-import-rdbms-to-couchbase.png 936w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/using-cbimport-data-import-rdbms-to-couchbase-300x117.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/using-cbimport-data-import-rdbms-to-couchbase-768x300.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/using-cbimport-data-import-rdbms-to-couchbase-20x8.png 20w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><strong>Couchbase\ub85c \ub370\uc774\ud130 \uac00\uc838\uc624\uae30\ub97c \uc900\ube44\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/strong><\/p>\n<p><strong>1\ub2e8\uacc4:<\/strong> SQL Server \ub0b4\ubcf4\ub0b4\uae30 \ub9c8\ubc95\uc0ac\ub97c \uc0ac\uc6a9\ud558\uc5ec \ud14c\uc774\ube14 \ub370\uc774\ud130\ub97c CSV\ub85c \ub0b4\ubcf4\ub0c5\ub2c8\ub2e4.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/sql-server-export-wizard-csv-data.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12257\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/sql-server-export-wizard-csv-data.png\" alt=\"SQL Server Export Wizard for CSV data\" width=\"374\" height=\"180\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/sql-server-export-wizard-csv-data.png 374w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/sql-server-export-wizard-csv-data-300x144.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/sql-server-export-wizard-csv-data-20x10.png 20w\" sizes=\"auto, (max-width: 374px) 100vw, 374px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><strong>2\ub2e8\uacc4:<\/strong> Import documents into Couchbase using `cbimport`:<\/p>\n<p>Open Windows Command prompt and redirect to `C:\\Program Files\\Couchbase\\Server\\bin` and run `cbimport` command. Please <a href=\"https:\/\/docs.couchbase.com\/server\/current\/tools\/cbimport-csv.html?ref=blog\" target=\"_blank\" rel=\"noopener\">refer to this documentation for more information about `cbimport` syntax<\/a>. Below is the example to import the `Customer.csv` file which is placed at path `D:\/CSVs` into the `dbo` scope and Customer Collection. Here the document key is `Customer Id` picked from the CSV Column name `CustomerId`.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/csv-data-import-couchbase-windows.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12258\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/csv-data-import-couchbase-windows.png\" alt=\"CSV data import to Couchbase using Windows\" width=\"936\" height=\"122\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/csv-data-import-couchbase-windows.png 936w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/csv-data-import-couchbase-windows-300x39.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/csv-data-import-couchbase-windows-768x100.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/csv-data-import-couchbase-windows-20x3.png 20w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Similarly, we can import `Address`, `ProductDetail`, `Order` and `OrderDetail` CSVs into corresponding collections within the `dbo` scope. At this time, we have five collections in `dbo` scope, and each collection has documents in it (highlighted below).<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/scope-collections-data-import-couchbase-web-console.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12259\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/scope-collections-data-import-couchbase-web-console.png\" alt=\"Data import for scopes and collections using the Couchbase Web Console\" width=\"998\" height=\"354\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/scope-collections-data-import-couchbase-web-console.png 998w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/scope-collections-data-import-couchbase-web-console-300x106.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/scope-collections-data-import-couchbase-web-console-768x272.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/scope-collections-data-import-couchbase-web-console-20x7.png 20w\" sizes=\"auto, (max-width: 998px) 100vw, 998px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><strong>3\ub2e8\uacc4:<\/strong> \uac00\uc838\uc628 \ub370\uc774\ud130\ub97c \ud655\uc778\ud574 \ubd05\uc2dc\ub2e4. \uc774 \ub2e8\uacc4\ub294 UI\ub97c \ud1b5\ud574 \ubb38\uc11c\ub97c \ud655\uc778\ud558\uac70\ub098 N1QL\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubb38\uc11c \uad6c\uc870\ub97c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. 5\uac1c\uc758 <a href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/services-and-indexes\/services\/index-service.html?ref=blog\" target=\"_blank\" rel=\"noopener\">\uae30\ubcf8 \uc778\ub371\uc2a4<\/a> \ub97c \uc0ac\uc6a9\ud558\uc5ec \uac01 \uceec\ub809\uc158\uc5d0 \ub300\ud574 \ubb38\uc11c \uac80\uc99d\uc744 \uc704\ud55c N1QL \ucffc\ub9ac\ub97c \uc2e4\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uac00\uc838\uc628 \ubb38\uc11c\uc758 \uc218\uc640 \ubb38\uc11c \uad6c\uc870, \uc18d\uc131 \ubc0f \ub370\uc774\ud130\ub97c \uc77c\uce58\uc2dc\ucf1c \uac80\uc99d\uc744 \uc218\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/data-verification-n1ql-query-indexes.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12260\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/data-verification-n1ql-query-indexes.png\" alt=\"Data verfication for indexes using a N1QL query\" width=\"996\" height=\"276\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/data-verification-n1ql-query-indexes.png 996w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/data-verification-n1ql-query-indexes-300x83.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/data-verification-n1ql-query-indexes-768x213.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/data-verification-n1ql-query-indexes-20x6.png 20w\" sizes=\"auto, (max-width: 996px) 100vw, 996px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><strong>\ucc38\uace0:<\/strong> N1QL \ucffc\ub9ac\ub97c \uc2e4\ud589\ud558\ub824\uba74 \ud574\ub2f9 \uceec\ub809\uc158\uc5d0 \ub300\ud55c \uc778\ub371\uc2a4(\uae30\ubcf8 \ub610\ub294 \ubcf4\uc870)\uac00 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<p>\uc544\ub798\ub294 \uac01 \uceec\ub809\uc158\uc5d0 \ub300\ud55c N1QL \ucffc\ub9ac \uacb0\uacfc\uc785\ub2c8\ub2e4(\ucffc\ub9ac \uacb0\uacfc \ubcf4\uae30\ub97c '\ud14c\uc774\ube14'\ub85c \ubcc0\uacbd\ud588\uc2b5\ub2c8\ub2e4):<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"vertical-align: middle\">Select c.* from testBucket.dbo.`Customer` c<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-customer-sample-data-2-table-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12250\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-customer-sample-data-2-table-1.png\" alt=\"N1QL query sample with customer data\" width=\"654\" height=\"222\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-customer-sample-data-2-table-1.png 654w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-customer-sample-data-2-table-1-300x102.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-customer-sample-data-2-table-1-20x7.png 20w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: middle\">Select a.* from testBucket.dbo.`Address` a<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-address-sample-data-2-table-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12249\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-address-sample-data-2-table-2.png\" alt=\"N1QL query sample with address data\" width=\"754\" height=\"268\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-address-sample-data-2-table-2.png 754w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-address-sample-data-2-table-2-300x107.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-address-sample-data-2-table-2-20x7.png 20w\" sizes=\"auto, (max-width: 754px) 100vw, 754px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: middle\">Select p.* from testBucket.dbo.`ProductDetails`<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-product-details-sample-data-2-table-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12253\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-product-details-sample-data-2-table-3.png\" alt=\"N1QL query sample with product details data\" width=\"528\" height=\"178\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-product-details-sample-data-2-table-3.png 528w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-product-details-sample-data-2-table-3-300x101.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-product-details-sample-data-2-table-3-20x7.png 20w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: middle\">Select o.* from testBucket.dbo.`Order` o<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-order-sample-data-2-table-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12252\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-order-sample-data-2-table-4.png\" alt=\"N1QL query sample with order data\" width=\"630\" height=\"252\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-order-sample-data-2-table-4.png 630w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-order-sample-data-2-table-4-300x120.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-order-sample-data-2-table-4-20x8.png 20w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: middle\">Select od.* from testBucket.dbo.`OrderDetails`<\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-order-details-sample-data-2-table-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12251\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-order-details-sample-data-2-table-5.png\" alt=\"N1QL query sample with order details data\" width=\"718\" height=\"274\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-order-details-sample-data-2-table-5.png 718w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-order-details-sample-data-2-table-5-300x114.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-order-details-sample-data-2-table-5-20x8.png 20w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Documents are imported successfully, but this is a one-to-one mapping, i.e., each table is imported as a collection. For tables where we need only one-to-one mapping (e.g., `ProductDetails`); data migration is complete at this step.<\/p>\n<p>However, for tables where we need to perform denormalization there are a few more steps before we get our final data model. For example, RDBMS tables `Customer`, `Address`, `Order` and `OrderDetails` must be merged into a single document. Your target data model should look something like:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/Couchbase-document-database-data-model-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12261\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/Couchbase-document-database-data-model-example.png\" alt=\"Couchbase document database data model example\" width=\"828\" height=\"474\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/Couchbase-document-database-data-model-example.png 828w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/Couchbase-document-database-data-model-example-300x172.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/Couchbase-document-database-data-model-example-768x440.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/Couchbase-document-database-data-model-example-20x11.png 20w\" sizes=\"auto, (max-width: 828px) 100vw, 828px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><strong>4\ub2e8\uacc4:<\/strong> \ub300\uc0c1 \ub300\uc0c1\uc758 \ube44\uc815\uaddc\ud654\ub97c \uc704\ud574(\uc608, <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/products\/server\/?ref=blog\" target=\"_blank\" rel=\"noopener\">\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \uc11c\ubc84<\/a>), we&#8217;ll follow a bottom-up approach. First we&#8217;ll merge `OrderDetails` into `Order`, then we&#8217;ll merge `Order` and `Address` into `Customer`.<\/p>\n<p>Let&#8217;s prepare a N1QL query to merge `OrderDetails` into an `Order` document. For this, we&#8217;ll use `group by` and `ARRAY_AGG` and the query will return an array of order details grouped by `Order Id`.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-merge-statement-limit-group-by-3-table-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12254\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-merge-statement-limit-group-by-3-table-1.png\" alt=\"N1QL query with merge statement, limit clause and group by clause\" width=\"450\" height=\"130\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-merge-statement-limit-group-by-3-table-1.png 450w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-merge-statement-limit-group-by-3-table-1-300x87.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-merge-statement-limit-group-by-3-table-1-20x6.png 20w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><br \/>\n<strong>\ucc38\uace0:<\/strong> You can use `limit keyword` after `group by` to restrict result size for faster execution on huge data.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-results-merge-statement-limit-group-by-3-table-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12255\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-results-merge-statement-limit-group-by-3-table-2.png\" alt=\"N1QL query results for a merge statement with limit and group by clauses\" width=\"288\" height=\"392\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-results-merge-statement-limit-group-by-3-table-2.png 288w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-results-merge-statement-limit-group-by-3-table-2-220x300.png 220w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-results-merge-statement-limit-group-by-3-table-2-15x20.png 15w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Now we have the `orderDetails` array ready. It&#8217;s time to merge it into an `Order` document. We&#8217;ll use <a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/merge.html?ref=blog\" target=\"_blank\" rel=\"noopener\">the Couchbase `MERGE` statement<\/a> to perform this operation. Here we&#8217;re adding a new attribute named `orderDetail` in every `Order` document when `Order.OrderId` and `OrderDetails.OrderId` are matched.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-merge-statement-order-detail-to-order-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12262\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-query-merge-statement-order-detail-to-order-example.png\" alt=\"An example N1QL query merge statement for Order detail to Order\" width=\"936\" height=\"206\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-merge-statement-order-detail-to-order-example.png 936w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-merge-statement-order-detail-to-order-example-300x66.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-merge-statement-order-detail-to-order-example-768x169.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-query-merge-statement-order-detail-to-order-example-20x4.png 20w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>\uc774 \ucffc\ub9ac\ub97c \uc2e4\ud589\ud558\uae30 \uc804\uc5d0 \ucffc\ub9ac\uc5d0 \ud544\uc694\ud55c \uc778\ub371\uc2a4\ub97c \uc0b4\ud3b4\ubcf4\uaca0\uc2b5\ub2c8\ub2e4. \uc774\uc804 \ucffc\ub9ac\ub294 \uae30\ubcf8 \uc778\ub371\uc2a4\uc5d0\uc11c \uc791\ub3d9\ud574\uc57c \ud558\uc9c0\ub9cc \ubcd1\ud569 \ubd80\ubd84\uc5d0\uc11c\ub294 \ubcf4\uc870 \uc778\ub371\uc2a4\ub97c \ub9cc\ub4e4\uc5b4\uc57c \ud569\ub2c8\ub2e4. Couchbase \uc778\ub371\uc2a4 \uc5b4\ub4dc\ubc14\uc774\uc800\uac00 \ub3c4\uc640\uc904 \ud14c\ub2c8 \uac71\uc815\ud558\uc9c0 \ub9c8\uc138\uc694.<\/p>\n<p>\ucffc\ub9ac \uc6cc\ud06c\ubca4\uce58\uc5d0\uc11c \uc704\uc758 \ucffc\ub9ac\ub97c \ubcf5\uc0ac\ud558\uace0 \"\uc778\ub371\uc2a4 \uc5b4\ub4dc\ubc14\uc774\uc800\" \ubc84\ud2bc\uc744 \ud074\ub9ad\ud569\ub2c8\ub2e4. \uadf8\ub7ec\uba74 \uc790\ub3d9\uc73c\ub85c <a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/createindex.html\">\uc778\ub371\uc2a4 \uc0dd\uc131<\/a> \ubb38\uc774 \uc774 \ucffc\ub9ac\ub97c \uc2e4\ud589\ud558\ub294 \ub370 \ud544\uc694\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/couchbase-query-workbench-index-advisor.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12263\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/couchbase-query-workbench-index-advisor.png\" alt=\"The Couchbase Query Workbench Index Advisor\" width=\"918\" height=\"198\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-query-workbench-index-advisor.png 918w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-query-workbench-index-advisor-300x65.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-query-workbench-index-advisor-768x166.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-query-workbench-index-advisor-20x4.png 20w\" sizes=\"auto, (max-width: 918px) 100vw, 918px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>I am taking a reference from the index advisor and appending a `WHERE` clause to create a partial index on the `Order` collection.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/couchbase-partial-index-where-clause.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12264\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/couchbase-partial-index-where-clause.png\" alt=\"Creating a partial index using a where clause in Couchbase\" width=\"896\" height=\"112\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-partial-index-where-clause.png 896w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-partial-index-where-clause-300x38.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-partial-index-where-clause-768x96.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-partial-index-where-clause-20x3.png 20w\" sizes=\"auto, (max-width: 896px) 100vw, 896px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>This partial index covers only those `Order` documents where the `orderDetail` attribute is missing. In case we have millions of `Order` documents, the number of documents in this index will start being reduced when we run `merge` statements in chunks (using the `LIMIT` keyword). For example, at this point we have six documents covered by this index.<\/p>\n<p>Creating a secondary index on the `OrderDetail` collection is similar, as shown below.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/couchbase-create-secondary-index-order-detail-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12265\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/couchbase-create-secondary-index-order-detail-example.png\" alt=\"Create a secondary index for order details example in Couchbase\" width=\"890\" height=\"54\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-create-secondary-index-order-detail-example.png 890w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-create-secondary-index-order-detail-example-300x18.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-create-secondary-index-order-detail-example-768x47.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/couchbase-create-secondary-index-order-detail-example-20x1.png 20w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>\uc774\uc81c \ub450 \uac1c\uc758 \uc778\ub371\uc2a4\uac00 \uc900\ube44\ub41c \uc0c1\ud0dc\uc785\ub2c8\ub2e4.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/two-indexes-ready-in-couchbase.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12266\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/two-indexes-ready-in-couchbase.png\" alt=\"Two indexes that are ready in Couchbase\" width=\"936\" height=\"164\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/two-indexes-ready-in-couchbase.png 936w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/two-indexes-ready-in-couchbase-300x53.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/two-indexes-ready-in-couchbase-768x135.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/two-indexes-ready-in-couchbase-20x4.png 20w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Next, let&#8217;s execute a `merge` statement with a `limit` clause. I have updated the `where` clause in the subquery (where `od.OrderId` is not missing) to select the appropriate index during execution.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-merge-statement-limit-clause-where-clause-subquery-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12267\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/n1ql-merge-statement-limit-clause-where-clause-subquery-example.png\" alt=\"A N1QL merge statement with a limit clause and where clause subquery example\" width=\"632\" height=\"292\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-merge-statement-limit-clause-where-clause-subquery-example.png 632w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-merge-statement-limit-clause-where-clause-subquery-example-300x139.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/n1ql-merge-statement-limit-clause-where-clause-subquery-example-20x9.png 20w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>This statement will update one `Order` document and append its associated `orderDetails` as a child document. In my case, it picked the `Order` document with `orderId=2` and updated it. `Order Id 2` has only one `orderDetails` document, so it added it as an array.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/example-merged-document-array-couchbase.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12268\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/example-merged-document-array-couchbase.png\" alt=\"An example of a merged document array in Couchbase\" width=\"282\" height=\"316\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/example-merged-document-array-couchbase.png 282w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/example-merged-document-array-couchbase-268x300.png 268w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/example-merged-document-array-couchbase-18x20.png 18w\" sizes=\"auto, (max-width: 282px) 100vw, 282px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Let&#8217;s have a look at the index. The document count decreased from six to five. This is because one document is not satisfying the partial index&#8217;s condition. This index will be updated as `order` documents are updated.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/index-partial-index-update-example-view-couchbase.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12269\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/index-partial-index-update-example-view-couchbase.png\" alt=\"An example index and partial index update view in Couchbase\" width=\"956\" height=\"168\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/index-partial-index-update-example-view-couchbase.png 956w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/index-partial-index-update-example-view-couchbase-300x53.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/index-partial-index-update-example-view-couchbase-768x135.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/index-partial-index-update-example-view-couchbase-20x4.png 20w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Now remove the `Limit` clause and run a `merge` query to update all `order` documents.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/merge-query-remove-limit-clause-update-documents-n1ql-statement.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12270\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/merge-query-remove-limit-clause-update-documents-n1ql-statement.png\" alt=\"a N1QL statement for merge query remove limit clause to update documents\" width=\"650\" height=\"214\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-remove-limit-clause-update-documents-n1ql-statement.png 650w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-remove-limit-clause-update-documents-n1ql-statement-300x99.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-remove-limit-clause-update-documents-n1ql-statement-20x7.png 20w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>This statement brings the `adv_OrderId` index document count to zero as all `Order` documents now have an attribute `orderDetail`.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/index-document-count-couchbase-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12271\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/index-document-count-couchbase-example.png\" alt=\"Index document count example in Couchbase\" width=\"936\" height=\"166\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/index-document-count-couchbase-example.png 936w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/index-document-count-couchbase-example-300x53.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/index-document-count-couchbase-example-768x136.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/index-document-count-couchbase-example-20x4.png 20w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>I randomly picked one `order` document (`orderId=9`) and included the output below.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/json-document-couchbase-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12272\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/json-document-couchbase-example.png\" alt=\"An example JSON document in Couchbase\" width=\"666\" height=\"578\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-couchbase-example.png 666w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-couchbase-example-300x260.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-couchbase-example-20x17.png 20w\" sizes=\"auto, (max-width: 666px) 100vw, 666px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Now we have an `Order` document ready with its child to merge into `Customer`. Let&#8217;s modify our `merge` query accordingly and create appropriate indexes for query execution:<\/p>\n<p>\ub0b4\ubd80 \ucffc\ub9ac\/\uc11c\ube0c\ucffc\ub9ac\uc5d0 \ub300\ud55c \uc778\ub371\uc2a4\uc785\ub2c8\ub2e4:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/create-index-inner-query-subquery-n1ql-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12273\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/create-index-inner-query-subquery-n1ql-example.png\" alt=\"A create index inner query subquery N1QL example\" width=\"896\" height=\"62\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-inner-query-subquery-n1ql-example.png 896w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-inner-query-subquery-n1ql-example-300x21.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-inner-query-subquery-n1ql-example-768x53.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-inner-query-subquery-n1ql-example-20x1.png 20w\" sizes=\"auto, (max-width: 896px) 100vw, 896px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The partial index for `Customer` collection:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/create-partial-index-for-collection-n1ql-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12274\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/create-partial-index-for-collection-n1ql-example.png\" alt=\"Creating a partial index for a collection N1QL example\" width=\"940\" height=\"40\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-partial-index-for-collection-n1ql-example.png 940w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-partial-index-for-collection-n1ql-example-300x13.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-partial-index-for-collection-n1ql-example-768x33.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-partial-index-for-collection-n1ql-example-20x1.png 20w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The `merge` query to merge `Orders` into `Customer`:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/merge-query-n1ql-example-customer-order-sample.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12275\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/merge-query-n1ql-example-customer-order-sample.png\" alt=\"A merge query N1QL example for a customer order\" width=\"624\" height=\"178\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-n1ql-example-customer-order-sample.png 624w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-n1ql-example-customer-order-sample-300x86.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-n1ql-example-customer-order-sample-20x6.png 20w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>After execution, this is the final `customer` document structure (randomly picked):<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/customer-document-structure-json-example-couchbase-server.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12276\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/customer-document-structure-json-example-couchbase-server.png\" alt=\"A customer document structure JSON example in Couchbase Server\" width=\"414\" height=\"714\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/customer-document-structure-json-example-couchbase-server.png 414w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/customer-document-structure-json-example-couchbase-server-174x300.png 174w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/customer-document-structure-json-example-couchbase-server-300x517.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/customer-document-structure-json-example-couchbase-server-12x20.png 12w\" sizes=\"auto, (max-width: 414px) 100vw, 414px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Up to this point, we have achieved denormalization of the `order`, `orderDetail` and `Customer` tables. Now let&#8217;s merge `address` as an array into `Customer` as we did the others.<\/p>\n<p>Creating the index for the `Customer` collection:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/create-index-for-collection-customer-example-couchbase.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12277\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/create-index-for-collection-customer-example-couchbase.png\" alt=\"Create index for a collection example in Couchbase\" width=\"936\" height=\"34\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-for-collection-customer-example-couchbase.png 936w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-for-collection-customer-example-couchbase-300x11.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-for-collection-customer-example-couchbase-768x28.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-for-collection-customer-example-couchbase-20x1.png 20w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Creating the index for the `address` collection:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/create-index-for-collection-address-example-couchbase-server.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12278\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/create-index-for-collection-address-example-couchbase-server.png\" alt=\"Create an index for a Collection using sample address data in Couchbase Server\" width=\"794\" height=\"52\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-for-collection-address-example-couchbase-server.png 794w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-for-collection-address-example-couchbase-server-300x20.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-for-collection-address-example-couchbase-server-768x50.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/create-index-for-collection-address-example-couchbase-server-20x1.png 20w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>The `merge` query to merge `address` into `Customer`:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/merge-query-address-to-customer-n1ql-statement-couchbase.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12279\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/merge-query-address-to-customer-n1ql-statement-couchbase.png\" alt=\"A N1QL statement to merge query addresses to customers in Couchbase\" width=\"714\" height=\"206\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-address-to-customer-n1ql-statement-couchbase.png 714w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-address-to-customer-n1ql-statement-couchbase-300x87.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/merge-query-address-to-customer-n1ql-statement-couchbase-20x6.png 20w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>\uc774 \ucffc\ub9ac\ub97c \uc2e4\ud589\ud558\uba74 4\uac1c\uc758 RDBMS \ud14c\uc774\ube14\ub85c \uad6c\uc131\ub41c \ucd5c\uc885 \ub370\uc774\ud130 \ubaa8\ub378\uc744 \uc5bb\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>`Customer` will be the parent document.<\/li>\n<li>`Address` will be an array of objects embedded in `customer`.<\/li>\n<li>`Order` will be an array of objects embedded in `customer`.<\/li>\n<li>`OrderDetails` will be an array of objects embedded in each `order` object.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>Final structure of the `customer` document:<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/json-document-final-structure-ecommerce-example-couchbase-database.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12280\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/10\/json-document-final-structure-ecommerce-example-couchbase-database.png\" alt=\"An ecommerce example JSON document final structure in Couchbase database\" width=\"404\" height=\"912\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-final-structure-ecommerce-example-couchbase-database.png 404w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-final-structure-ecommerce-example-couchbase-database-133x300.png 133w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-final-structure-ecommerce-example-couchbase-database-300x677.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/json-document-final-structure-ecommerce-example-couchbase-database-9x20.png 9w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/a><\/p>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>\ub9c8\uc9c0\ub9c9\uc73c\ub85c, N1QL \ucffc\ub9ac\ub97c \uc0ac\uc6a9\ud558\uc5ec \ubaa9\ud45c \ub370\uc774\ud130 \ubaa8\ub378\uc5d0 \ub530\ub77c \ube44\uc815\uaddc\ud654\ub97c \ub2ec\uc131\ud588\uc2b5\ub2c8\ub2e4.<\/p>\n<p>We can modify the sub-query to select a number of attributes\/columns instead of `*`. Furthermore, we can use <a href=\"https:\/\/docs.couchbase.com\/server\/current\/n1ql\/n1ql-language-reference\/objectfun.html?ref=blog\" target=\"_blank\" rel=\"noopener\">\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \uac1d\uccb4 \ud568\uc218<\/a> \ub97c \ud074\ub9ad\ud558\uc5ec \ud558\uc704 \ucffc\ub9ac\/\ubd80\ubaa8 \uacb0\uacfc\uc5d0\uc11c \uc18d\uc131\uc744 \ucd94\uac00\/\uc81c\uac70\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><strong>5\ub2e8\uacc4<\/strong> (\uc120\ud0dd \uc0ac\ud56d)<strong>:<\/strong> Now it&#8217;s time to clean up. Since we have our target data model with us in the `Customer` collection, we can delete the other three collections (`address`, `order` and `orderDetails`).<\/p>\n<h2>\uacb0\ub860<\/h2>\n<p>\uc694\uc57d\ud558\uba74, \ubaa9\uc801\uc9c0\uc5d0\uc11c\uc758 \ube44\uc815\uaddc\ud654\ub294 \uc801\uc808\ud55c \uc778\ub371\uc2a4\uc640 \ud568\uaed8 N1QL \ucffc\ub9ac \uc5b8\uc5b4\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub2ec\uc131\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub370\uc774\ud130 \ubaa8\ub378\uc5d0\uc11c \uac00\uc7a5 \uc544\ub798\ucabd \ud558\uc704 \ub370\uc774\ud130\ubd80\ud130 \uc2dc\uc791\ud558\uc5ec \uc694\uad6c \uc0ac\ud56d\uc5d0 \ub530\ub77c \ubaa8\ub4e0 \uc218\uc900\uc758 \uc911\ucca9\uc5d0 \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<div class=\"wp-block-spacer\" style=\"height: 30px\" aria-hidden=\"true\"><\/div>\n<div style=\"text-align: center\"><strong>\uce74\uc6b0\uce58\ubca0\uc774\uc2a4\ub97c \uc9c1\uc811 \uccb4\ud5d8\ud574 \ubcf4\uc138\uc694: <a href=\"https:\/\/www.couchbase.com\/blog\/ko\/downloads\/?ref=blog\" target=\"_blank\" rel=\"noopener\">\uc9c0\uae08 Couchbase Server 7.0 \ub2e4\uc6b4\ub85c\ub4dc\ud558\uae30<\/a><\/strong><\/div>\n<div class=\"wp-block-spacer\" style=\"height: 15px\" aria-hidden=\"true\"><\/div>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Data migration is full of challenges. While migrating from a relational database (RDBMS) like SQL Server or Oracle, your main challenge comes at the time of denormalizing migrated documents as per the target data models. With the introduction of scopes [&hellip;]<\/p>","protected":false},"author":79093,"featured_media":12241,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,2381,1821,1816,1819,9381,9336,1812],"tags":[9261,1766,9467,1383,1261,1592,9301,1556,1634],"ppma_author":[9456],"class_list":["post-12239","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-community","category-couchbase-architecture","category-couchbase-server","category-data-modeling","category-indexing","category-scopes-and-collections","category-n1ql-query","tag-data-import","tag-data-migration","tag-denormalization","tag-etl","tag-json","tag-oracle","tag-relational-database","tag-sql-server","tag-windows"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Denormalize Imported Documents from RDBMS Tables Using N1QL<\/title>\n<meta name=\"description\" content=\"Learn how to denormalize your data at destination using N1QL queries for data imported from a relational database into Couchbase documents in this tutorial.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/ko\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Denormalize Imported Documents from RDBMS Tables Using N1QL\" \/>\n<meta property=\"og:description\" content=\"Learn how to denormalize your data at destination using N1QL queries for data imported from a relational database into Couchbase documents in this tutorial.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/ko\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-01T16:00:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T00:20:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries-social.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"418\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Gurmeet Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries-social.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gurmeet Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/\"},\"author\":{\"name\":\"Gurmeet Singh\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/9bf03dbd6919b86b1e51d1805930a9c0\"},\"headline\":\"How to Denormalize Imported Documents from RDBMS Tables Using N1QL\",\"datePublished\":\"2021-12-01T16:00:23+00:00\",\"dateModified\":\"2025-06-14T00:20:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/\"},\"wordCount\":1820,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries.jpg\",\"keywords\":[\"data import\",\"Data Migration\",\"denormalization\",\"ETL\",\"JSON\",\"oracle\",\"relational database\",\"SQL Server\",\"windows\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Community\",\"Couchbase Architecture\",\"Couchbase Server\",\"Data Modeling\",\"Indexing\",\"Scopes and Collections\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/\",\"name\":\"How to Denormalize Imported Documents from RDBMS Tables Using N1QL\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries.jpg\",\"datePublished\":\"2021-12-01T16:00:23+00:00\",\"dateModified\":\"2025-06-14T00:20:52+00:00\",\"description\":\"Learn how to denormalize your data at destination using N1QL queries for data imported from a relational database into Couchbase documents in this tutorial.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries.jpg\",\"width\":1200,\"height\":628,\"caption\":\"Learn how to import and denormalize your data from a relational database into Couchbase using N1QL\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Denormalize Imported Documents from RDBMS Tables Using N1QL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/9bf03dbd6919b86b1e51d1805930a9c0\",\"name\":\"Gurmeet Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/2cdd1db26a1b7caeef64c60b46df28e4\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/gurmeet-singh-infosys.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/gurmeet-singh-infosys.png\",\"caption\":\"Gurmeet Singh\"},\"description\":\"Gurmeet is working as a Technology Lead at Infosys and has more than 9 years of experience in full-stack development including front-end, backend and databases. Gurmeet holds a Bachelor's Degree in Computer Science from Punjab Technical University, India. See his LinkedIn profile for more details: https:\/\/www.linkedin.com\/in\/gurmeet-singh-04281381\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/ko\/author\/gurmeet-singh\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"N1QL\uc744 \uc0ac\uc6a9\ud558\uc5ec RDBMS \ud14c\uc774\ube14\uc5d0\uc11c \uac00\uc838\uc628 \ubb38\uc11c\ub97c \ube44\uc815\uaddc\ud654\ud558\ub294 \ubc29\ubc95","description":"\uc774 \uc790\uc2b5\uc11c\uc5d0\uc11c\ub294 \uad00\uacc4\ud615 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0\uc11c Couchbase \ubb38\uc11c\ub85c \uac00\uc838\uc628 \ub370\uc774\ud130\uc5d0 \ub300\ud574 N1QL \ucffc\ub9ac\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub300\uc0c1\uc5d0\uc11c \ub370\uc774\ud130\ub97c \ube44\uc815\uaddc\ud654\ud558\ub294 \ubc29\ubc95\uc744 \uc54c\uc544\ubcf4\uc138\uc694.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/ko\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/","og_locale":"ko_KR","og_type":"article","og_title":"How to Denormalize Imported Documents from RDBMS Tables Using N1QL","og_description":"Learn how to denormalize your data at destination using N1QL queries for data imported from a relational database into Couchbase documents in this tutorial.","og_url":"https:\/\/www.couchbase.com\/blog\/ko\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-12-01T16:00:23+00:00","article_modified_time":"2025-06-14T00:20:52+00:00","og_image":[{"width":800,"height":418,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries-social.jpg","type":"image\/jpeg"}],"author":"Gurmeet Singh","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries-social.jpg","twitter_misc":{"Written by":"Gurmeet Singh","Est. reading time":"16\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/"},"author":{"name":"Gurmeet Singh","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/9bf03dbd6919b86b1e51d1805930a9c0"},"headline":"How to Denormalize Imported Documents from RDBMS Tables Using N1QL","datePublished":"2021-12-01T16:00:23+00:00","dateModified":"2025-06-14T00:20:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/"},"wordCount":1820,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries.jpg","keywords":["data import","Data Migration","denormalization","ETL","JSON","oracle","relational database","SQL Server","windows"],"articleSection":["Best Practices and Tutorials","Community","Couchbase Architecture","Couchbase Server","Data Modeling","Indexing","Scopes and Collections","SQL++ \/ N1QL Query"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/","url":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/","name":"N1QL\uc744 \uc0ac\uc6a9\ud558\uc5ec RDBMS \ud14c\uc774\ube14\uc5d0\uc11c \uac00\uc838\uc628 \ubb38\uc11c\ub97c \ube44\uc815\uaddc\ud654\ud558\ub294 \ubc29\ubc95","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries.jpg","datePublished":"2021-12-01T16:00:23+00:00","dateModified":"2025-06-14T00:20:52+00:00","description":"\uc774 \uc790\uc2b5\uc11c\uc5d0\uc11c\ub294 \uad00\uacc4\ud615 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0\uc11c Couchbase \ubb38\uc11c\ub85c \uac00\uc838\uc628 \ub370\uc774\ud130\uc5d0 \ub300\ud574 N1QL \ucffc\ub9ac\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub300\uc0c1\uc5d0\uc11c \ub370\uc774\ud130\ub97c \ube44\uc815\uaddc\ud654\ud558\ub294 \ubc29\ubc95\uc744 \uc54c\uc544\ubcf4\uc138\uc694.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/denormalization-guide-data-import-rdbms-tables-couchbase-n1ql-queries.jpg","width":1200,"height":628,"caption":"Learn how to import and denormalize your data from a relational database into Couchbase using N1QL"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Denormalize Imported Documents from RDBMS Tables Using N1QL"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \ube14\ub85c\uadf8","description":"NoSQL \ub370\uc774\ud130\ubca0\uc774\uc2a4, Couchbase","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \ube14\ub85c\uadf8","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/9bf03dbd6919b86b1e51d1805930a9c0","name":"\uad6c\ub974\ubbf8\ud2b8 \uc2f1","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/2cdd1db26a1b7caeef64c60b46df28e4","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/gurmeet-singh-infosys.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/gurmeet-singh-infosys.png","caption":"Gurmeet Singh"},"description":"\uad6c\ub974\ubc0b\uc740 Infosys\uc5d0\uc11c \uae30\uc220 \ucc45\uc784\uc790\ub85c \uc77c\ud558\uace0 \uc788\uc73c\uba70 \ud504\ub860\ud2b8\uc5d4\ub4dc, \ubc31\uc5d4\ub4dc \ubc0f \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c \ud3ec\ud568\ud55c \ud480\uc2a4\ud0dd \uac1c\ubc1c \ubd84\uc57c\uc5d0\uc11c 9\ub144 \uc774\uc0c1\uc758 \uacbd\ub825\uc744 \ubcf4\uc720\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uc778\ub3c4 \ud380\uc7a1 \uacf5\uacfc\ub300\ud559\uad50\uc5d0\uc11c \ucef4\ud4e8\ud130 \uacf5\ud559 \ud559\uc0ac \ud559\uc704\ub97c \ucde8\ub4dd\ud588\uc2b5\ub2c8\ub2e4. \uc790\uc138\ud55c \ub0b4\uc6a9\uc740 \uadf8\uc758 LinkedIn \ud504\ub85c\ud544\uc744 \ucc38\uc870\ud558\uc138\uc694: https:\/\/www.linkedin.com\/in\/gurmeet-singh-04281381\/","url":"https:\/\/www.couchbase.com\/blog\/ko\/author\/gurmeet-singh\/"}]}},"authors":[{"term_id":9456,"user_id":79093,"is_guest":0,"slug":"gurmeet-singh","display_name":"Gurmeet Singh","avatar_url":{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/gurmeet-singh-infosys.png","url2x":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/10\/gurmeet-singh-infosys.png"},"author_category":"","last_name":"Singh","first_name":"Gurmeet","job_title":"","user_url":"https:\/\/www.linkedin.com\/in\/gurmeet-singh-04281381\/","description":"\uad6c\ub974\ubc0b\uc740 Infosys\uc5d0\uc11c \uae30\uc220 \ucc45\uc784\uc790\ub85c \uc77c\ud558\uace0 \uc788\uc73c\uba70 \ud504\ub860\ud2b8\uc5d4\ub4dc, \ubc31\uc5d4\ub4dc \ubc0f \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c \ud3ec\ud568\ud55c \ud480\uc2a4\ud0dd \uac1c\ubc1c \ubd84\uc57c\uc5d0\uc11c 9\ub144 \uc774\uc0c1\uc758 \uacbd\ub825\uc744 \ubcf4\uc720\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uc778\ub3c4 \ud380\uc7a1 \uacf5\uacfc\ub300\ud559\uad50\uc5d0\uc11c \ucef4\ud4e8\ud130 \uacf5\ud559 \ud559\uc0ac \ud559\uc704\ub97c \ucde8\ub4dd\ud588\uc2b5\ub2c8\ub2e4. \uc790\uc138\ud55c \ub0b4\uc6a9\uc740 \uadf8\uc758 LinkedIn \ud504\ub85c\ud544\uc744 \ucc38\uc870\ud558\uc138\uc694: https:\/\/www.linkedin.com\/in\/gurmeet-singh-04281381\/"}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/12239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/users\/79093"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/comments?post=12239"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/12239\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media\/12241"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media?parent=12239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/categories?post=12239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/tags?post=12239"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/ppma_author?post=12239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}