{"id":6502,"date":"2019-03-12T09:31:53","date_gmt":"2019-03-12T16:31:53","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=6502"},"modified":"2025-06-13T17:22:10","modified_gmt":"2025-06-14T00:22:10","slug":"get-a-bigger-picture-with-n1ql-window-functions-and-cte","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/","title":{"rendered":"Obtenga una visi\u00f3n m\u00e1s amplia con las funciones de ventana y CTE de N1QL"},"content":{"rendered":"<p>Tanto si se trata de una necesidad personal de entender su patr\u00f3n de gasto a partir de las transacciones bancarias, como si se trata de mejorar el rendimiento de las ventas en su organizaci\u00f3n mediante el an\u00e1lisis de las actividades de ventas, los conocimientos reales s\u00f3lo son visibles con la agregaci\u00f3n y el resumen adicionales de los datos a nivel transaccional. El RDBMS tradicional proporciona esta capacidad a trav\u00e9s del poder expresivo de la agregaci\u00f3n SQL. Las funciones de ventana se a\u00f1adieron al est\u00e1ndar ANSI SQL para ampliar a\u00fan m\u00e1s la capacidad de expresar preguntas m\u00e1s complejas con el constructo SQL.<\/p>\n<p>Couchbase N1QL ahora soporta las funciones de ventana y la expresi\u00f3n de tabla com\u00fan (CTE) en su versi\u00f3n 6.5. Los desarrolladores pueden ampliar sus aplicaciones para satisfacer casos de uso empresarial m\u00e1s complejos, adem\u00e1s de permitir a los analistas de datos obtener las respuestas que necesitan sin necesidad de realizar un posprocesamiento adicional en Excel.<\/p>\n<p>En este art\u00edculo me centrar\u00e9 en un par de ejemplos sobre c\u00f3mo puede aprovechar las funciones de ventana N1QL y CTE para abordar dos preguntas de negocio muy comunes.<\/p>\n<h3>Duraci\u00f3n de las actividades de venta por cliente<\/h3>\n<p>En este primer ejemplo para un sistema de gesti\u00f3n de la actividad de ventas, queremos proporcionar un informe que muestre la cantidad de tiempo que el equipo de ventas ha pasado trabajando con sus clientes durante enero-2019. Desglosar\u00e9 la consulta en dos pasos:<\/p>\n<p>1) Obtener una lista de las reuniones y la duraci\u00f3n de las mismas que el equipo de ventas ha realizado con sus clientes. El tiempo total empleado para todos los clientes 'tiempo_total_empleado' se calcula sumando la duraci\u00f3n de las citas con una cl\u00e1usula OVER () vac\u00eda, que realizar\u00e1 la suma para todo el conjunto de resultados. El tiempo total empleado por cliente 'tiempo_cuenta_empleado' utiliza la misma construcci\u00f3n, pero con 'accid' para la cl\u00e1usula PARTITION.<\/p>\n<pre class=\"font:courier-new show-lang:2 lang:mysql decode:true\">SELECT  c.name, a.startDate, a.title, a.duration, \r\n        SUM(a.duration) OVER() as total_time_spent,\r\n        SUM(a.duration) OVER(PARTITION BY a.accid) AS account_time_spent\r\nFROM crm a\r\n  INNER JOIN crm c ON a.accid = c.id AND  c.type='account'\r\nWHERE a.type='activity'\r\nAND a.activityType='Appointment'\r\nAND a.startDate BETWEEN '2018-01-01' and '2018-01-31'\r\n<\/pre>\n<pre class=\"font:courier-new tab-convert:true lang:mysql decode:true\">account_time_spent\tduration\tname\tstartDate\ttitle\ttotal_time_spent\r\n30\t\"30\"\t\"Smith, Avila and Cisneros\"\t\"2018-01-24 15:00:00\"\t\"Switchable coherent adapter\"\t25770\r\n510\t\"150\"\t\"Riddle Ltd\"\t\"2018-01-05 15:30:00\"\t\"Streamlined intermediate intranet\"\t25770\r\n510\t\"90\"\t\"Riddle Ltd\"\t\"2018-01-28 14:30:00\"\t\"Advanced solution-oriented synergy\"\t25770\r\n510\t\"90\"\t\"Riddle Ltd\"\t\"2018-01-01 15:00:00\"\t\"Ameliorated object-oriented methodology\"\t25770\r\n510\t\"30\"\t\"Riddle Ltd\"\t\"2018-01-10 08:00:00\"\t\"Object-based multi-state firmware\"\t25770\r\n510\t\"150\"\t\"Riddle Ltd\"\t\"2018-01-23 09:00:00\"\t\"Multi-layered systematic software\"\t25770\r\n120\t\"30\"\t\"Foster Inc\"\t\"2018-01-29 09:30:00\"\t\"Public-key bottom-line database\"\t25770\r\n120\t\"30\"\t\"Foster Inc\"\t\"2018-01-09 13:00:00\"\t\"Quality-focused local emulation\"\t25770\r\n120\t\"60\"\t\"Foster Inc\"\t\"2018-01-02 08:00:00\"\t\"Digitized motivating matrix\"\t25770\r\n120\t\"30\"\t\"Williams Ltd\"\t\"2018-01-22 08:30:00\"\t\"Versatile heuristic workforce\"\t25770\r\n120\t\"30\"\t\"Williams Ltd\"\t\"2018-01-24 13:30:00\"\t\"Front-line 4thgeneration help-desk\"\t25770\r\n120\t\"60\"\t\"Williams Ltd\"\t\"2018-01-14 14:30:00\"\t\"Visionary upward-trending success\"\t25770\r\n330\t\"150\"\t\"Reid Ltd\"\t\"2018-01-21 10:30:00\"\t\"Profound logistical archive\"\t25770\r\n330\t\"30\"\t\"Reid Ltd\"\t\"2018-01-13 13:30:00\"\t\"Down-sized coherent access\"\t25770\r\n330\t\"120\"\t\"Reid Ltd\"\t\"2018-01-02 12:00:00\"\t\"Front-line object-oriented moderator\"\t25770\r\n330\t\"30\"\t\"Reid Ltd\"\t\"2018-01-12 09:30:00\"\t\"Programmable reciprocal infrastructure\"\t25770\r\n....<\/pre>\n<p>2) A continuaci\u00f3n, utilice las dos m\u00e9tricas para obtener el porcentaje del tiempo total que el equipo dedic\u00f3 a cada cliente.<\/p>\n<pre class=\"font:courier-new lang:mysql decode:true\">SELECT  c.name,  \r\n  ROUND(( SUM(SUM(a.duration)) OVER(PARTITION BY a.accid)  \/ \r\n   SUM(SUM(a.duration)) OVER()),2) as pct_time\r\nFROM crm a\r\nINNER JOIN crm c ON a.accid = c.id AND  c.type='account'\r\nWHERE a.type='activity'\r\n  AND a.activityType='Appointment'\r\n  AND a.startDate BETWEEN '2018-01-01' and '2018-01-31'\r\nGROUP BY c.name, a.accid\r\nORDER BY 2 DESC<\/pre>\n<pre class=\"font:courier-new lang:default decode:true\">name\tpct_time\r\n\"Johnson, Adams and Kelly\"\t0.17\r\n\"Davis Group\"\t0.08\r\n\"Gilbert-Morris\"\t0.08\r\n\"Torres and Sons\"\t0.07\r\n\"Reid Ltd\"\t0.07\r\n\"Medina-Daniels\"\t0.07\r\n\"Riddle Ltd\"\t0.05\r\n\"Henderson and Sons\"\t0.05\r\n\"Gill and Sons\"\t0.05\r\n\"Garcia-Young\"\t0.05\r\n\"Sullivan PLC\"\t0.03\r\n\"Brown-Rogers\"\t0.03\r\n\"Foster Inc\"\t0.03\r\n\"Wheeler Inc\"\t0.03\r\n\"Jarvis-Small\"\t0.03\r\n\"Jones-Fox\"\t0.03\r\n\"Lloyd, Blair and Pruitt\"\t0.03\r\n\"Vaughn LLC\"\t0.02\r\n<\/pre>\n<h3>Actividades de venta mes a mes<\/h3>\n<p>En este segundo ejemplo, la consulta muestra c\u00f3mo ha cambiado el n\u00famero de tareas relacionadas con las ventas mes a mes para el a\u00f1o 2018.  La consulta aprovecha la funci\u00f3n CTE de N1QL para mejorar la legibilidad de la consulta, y tambi\u00e9n la funci\u00f3n de ventana LAG para obtener el recuento de tareas del periodo anterior.<\/p>\n<pre class=\"font:courier-new lang:mysql decode:true\">WITH current_period_task AS (\r\n  SELECT DATE_TRUNC_STR(a.startDate,'month') AS month,\r\n         COUNT(1) AS current_period_task_count\r\n  FROM crm a \r\n  WHERE a.type='activity' AND a.activityType = 'Task'\r\n    AND   DATE_PART_STR(a.startDate,'year') = 2018\r\n    GROUP BY DATE_TRUNC_STR(a.startDate,'month')\r\n), \r\nlast_period_task AS ( \r\n   SELECT x.month, x.current_period_task_count, \r\n          LAG(x.current_period_task_count) OVER ( ORDER BY x.month) AS last_period_task_count \r\n   FROM current_period_task x\r\n)\r\nSELECT b.month, \r\n       b.current_period_task_count, \r\n       ROUND(((b.current_period_task_count - b.last_period_task_count ) \/ b.last_period_task_count),2) AS MoMChg\r\nFROM last_period_task AS b<\/pre>\n<ol>\n<li>El primer CTE - 'current_period_task' define la consulta para recuperar un recuento de todas las actividades de tipo Task agrupadas por el mes natural.<\/li>\n<li>El segundo CTE - 'last_period_task' lee del primer CTE, y tambi\u00e9n aprovecha la funci\u00f3n de ventana LAG para devolver el recuento de tareas del mes anterior. Tenga en cuenta que la cl\u00e1usula ORDER BY es fundamental para que la funci\u00f3n LAG funcione.<\/li>\n<li>La consulta principal lee del segundo CTE - 'last_period_task' y deriva el c\u00e1lculo mes a mes.<\/li>\n<\/ol>\n<pre class=\"font:courier-new tab-convert:true lang:default decode:true\" title=\"Salida:\">MoMChg\tcurrent_period_task_count\tmonth\r\n\t283\t\"2018-01-01\"\r\n-0.08\t260\t\"2018-02-01\"\r\n0.1\t287\t\"2018-03-01\"\r\n-0.08\t264\t\"2018-04-01\"\r\n0.11\t292\t\"2018-05-01\"\r\n0\t293\t\"2018-06-01\"\r\n-0.03\t285\t\"2018-07-01\"\r\n0\t285\t\"2018-08-01\"\r\n0\t284\t\"2018-09-01\"\r\n0\t283\t\"2018-10-01\"\r\n-0.05\t268\t\"2018-11-01\"\r\n0.06\t285\t\"2018-12-01\"\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Recursos<\/h3>\n<ul>\n<li><i>Descargar<\/i>:\u00a0<a href=\"https:\/\/www.couchbase.com\/blog\/es\/downloads\/?family=server&amp;product=couchbase-server-developer\">Descargar Couchbase Server 6.5<\/a><i><\/i><\/li>\n<li><i>Documentaci\u00f3n<\/i>:\u00a0<a href=\"https:\/\/docs.couchbase.com\/server\/6.5\/introduction\/whats-new.html\">Novedades de Couchbase Server 6.5<\/a><i><\/i><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/es\/tag\/6-5\/\"><b>Todos los blogs de 6.5<\/b><\/a><\/li>\n<\/ul>\n<p>Nos encantar\u00eda que nos dijera qu\u00e9 le han parecido las funciones de la versi\u00f3n 6.5 y en qu\u00e9 beneficiar\u00e1n a su empresa en el futuro. Por favor, comparta su opini\u00f3n a trav\u00e9s de los comentarios o en el\u00a0<a href=\"https:\/\/www.couchbase.com\/blog\/es\/forums\/\">foro<\/a>.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Whether it is a personal need to understand your spending pattern from looking at the bank transactions, or seeking to improve the sales performance in your organization by looking at the sales activities, the real insights are only visible with [&hellip;]<\/p>","protected":false},"author":26326,"featured_media":6547,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1814,1815,1819,1812],"tags":[2378,2306],"ppma_author":[8919],"class_list":["post-6502","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-best-practices-and-tutorials","category-data-modeling","category-n1ql-query","tag-6-5","tag-analytical-functions"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.0 (Yoast SEO v26.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Get a Bigger Picture with N1QL Window Functions and CTE<\/title>\n<meta name=\"description\" content=\"This article focuses on a couple of examples of how you can leverage N1QL Window functions and CTE to address two very common business questions.\" \/>\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\/es\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get a Bigger Picture with N1QL Window Functions and CTE\" \/>\n<meta property=\"og:description\" content=\"This article focuses on a couple of examples of how you can leverage N1QL Window functions and CTE to address two very common business questions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-12T16:31:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T00:22:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1334\" \/>\n\t<meta property=\"og:image:height\" content=\"346\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Binh Le\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Binh Le\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/\"},\"author\":{\"name\":\"Binh Le\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f89064928e262c71eb43bee996c48c63\"},\"headline\":\"Get a Bigger Picture with N1QL Window Functions and CTE\",\"datePublished\":\"2019-03-12T16:31:53+00:00\",\"dateModified\":\"2025-06-14T00:22:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/\"},\"wordCount\":496,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png\",\"keywords\":[\"6.5\",\"analytical functions\"],\"articleSection\":[\"Application Design\",\"Best Practices and Tutorials\",\"Data Modeling\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/\",\"name\":\"Get a Bigger Picture with N1QL Window Functions and CTE\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png\",\"datePublished\":\"2019-03-12T16:31:53+00:00\",\"dateModified\":\"2025-06-14T00:22:10+00:00\",\"description\":\"This article focuses on a couple of examples of how you can leverage N1QL Window functions and CTE to address two very common business questions.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png\",\"width\":1334,\"height\":346},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get a Bigger Picture with N1QL Window Functions and CTE\"}]},{\"@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\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@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\/f89064928e262c71eb43bee996c48c63\",\"name\":\"Binh Le\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/5b68c37e30928a9d7b2c8470b1a303b7\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g\",\"caption\":\"Binh Le\"},\"description\":\"Binh Le is a Principal Product Manager for Couchbase Query service. Prior to Couchbase, he worked at Oracle and led the product management team for Sales Cloud Analytics and CRM OnDemand. Binh holds a Bachelor's Degree in Computer Science from the University of Brighton, UK.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/es\/author\/binh-le-2\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Obtenga una visi\u00f3n m\u00e1s amplia con las funciones de ventana y CTE de N1QL","description":"Este art\u00edculo se centra en un par de ejemplos de c\u00f3mo puede aprovechar las funciones de ventana y CTE de N1QL para abordar dos cuestiones empresariales muy comunes.","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\/es\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/","og_locale":"es_MX","og_type":"article","og_title":"Get a Bigger Picture with N1QL Window Functions and CTE","og_description":"This article focuses on a couple of examples of how you can leverage N1QL Window functions and CTE to address two very common business questions.","og_url":"https:\/\/www.couchbase.com\/blog\/es\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/","og_site_name":"The Couchbase Blog","article_published_time":"2019-03-12T16:31:53+00:00","article_modified_time":"2025-06-14T00:22:10+00:00","og_image":[{"width":1334,"height":346,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png","type":"image\/png"}],"author":"Binh Le","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Binh Le","Est. reading time":"4 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/"},"author":{"name":"Binh Le","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f89064928e262c71eb43bee996c48c63"},"headline":"Get a Bigger Picture with N1QL Window Functions and CTE","datePublished":"2019-03-12T16:31:53+00:00","dateModified":"2025-06-14T00:22:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/"},"wordCount":496,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png","keywords":["6.5","analytical functions"],"articleSection":["Application Design","Best Practices and Tutorials","Data Modeling","SQL++ \/ N1QL Query"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/","url":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/","name":"Obtenga una visi\u00f3n m\u00e1s amplia con las funciones de ventana y CTE de N1QL","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png","datePublished":"2019-03-12T16:31:53+00:00","dateModified":"2025-06-14T00:22:10+00:00","description":"Este art\u00edculo se centra en un par de ejemplos de c\u00f3mo puede aprovechar las funciones de ventana y CTE de N1QL para abordar dos cuestiones empresariales muy comunes.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/03\/Screen-Shot-2019-03-11-at-9.50.05-AM.png","width":1334,"height":346},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/get-a-bigger-picture-with-n1ql-window-functions-and-cte\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Get a Bigger Picture with N1QL Window Functions and CTE"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","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":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@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\/f89064928e262c71eb43bee996c48c63","name":"Binh Le","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/5b68c37e30928a9d7b2c8470b1a303b7","url":"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g","caption":"Binh Le"},"description":"Binh Le is a Principal Product Manager for Couchbase Query service. Prior to Couchbase, he worked at Oracle and led the product management team for Sales Cloud Analytics and CRM OnDemand. Binh holds a Bachelor's Degree in Computer Science from the University of Brighton, UK.","url":"https:\/\/www.couchbase.com\/blog\/es\/author\/binh-le-2\/"}]}},"authors":[{"term_id":8919,"user_id":26326,"is_guest":0,"slug":"binh-le-2","display_name":"Binh Le","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/a939f48df6447844a8780bec264bb3be21d589336f3915fabc557075a68fa374?s=96&d=mm&r=g","author_category":"","last_name":"Le","first_name":"Binh","job_title":"","user_url":"","description":"Binh Le es director de producto principal del servicio de consultas de Couchbase. Antes de Couchbase, trabaj\u00f3 en Oracle y dirigi\u00f3 el equipo de gesti\u00f3n de productos para Sales Clould Analytics y CRM OnDemand. Binh es licenciado en Inform\u00e1tica por la Universidad de Brighton, Reino Unido."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/6502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/26326"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=6502"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/6502\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/6547"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=6502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=6502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=6502"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=6502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}