Use of Oracle SQL to twist data around - unpivot columns to rows, pivot rows to columns, parse delimited strings to columns and rows, turn rows into delimited strings. Presentation given at OUGN Spring Conference 2016.
The document discusses analytic functions in SQL Server. It explains that analytic functions allow calculations on a set of rows and return a value for each row. Some common analytic functions include SUM, COUNT, MIN, MAX, RANK, and LEAD/LAG. These functions can be used with a PARTITION BY clause to perform the calculation separately over groups of rows.
Obtaining, Scrubbing, and Exploring Data at the Command Line by Jeroen Janssens Hakka Labs
Data scientists love to create exciting data visualizations and insightful models. However, before they get to that point, usually much effort goes into obtaining, scrubbing, and exploring the required data. In this presentation, Jeroen Janssens from YPlan,gives insight into the *nix command line. Although it was invented decades ago, it remains a powerful environment for many data science tasks. It provides a read-eval-print loop (REPL) that is often much more convenient for exploratory data analysis than the edit-compile-run-debug cycle associated with scripts or even programs. Even if you're already comfortable processing data with, for example, R or Python, being able to also leverage the power of the command line can make any data scientist more efficient.
ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012ITCamp
This document contains summaries of new features in various versions of Microsoft SQL Server from 2000 to 2012. It begins with a brief history of SQL and an overview of basic database concepts. Each major version is then discussed in its own section, with new syntax, functions, and capabilities highlighted at a high level. The document concludes with a recommendation to learn more about SQL Server memory-optimized tables and attending additional training.
The document provides information on various open source charting and graphing libraries including Google Chart Tools, Sencha Ext JS, Protovis, Highcharts, D3, RGraph, and others. For each library, it lists the URL, demo site, programming languages used, and license type. The libraries covered allow for creating different types of charts and graphs like bubble charts, motion charts, scatter plots, pie charts, radar charts, and more.
Required for certification, window functions are powerful analytic functions built into SQL Server. SQL Server 2005 introduced the core window ranking functions, and SQL Server 2012 added time and statistical percentage window functions. These functions allow for advanced variable creation, and are of direct benefit to people creating features for data science. This talk will also recommend further reading on this topic.
Exploring Advanced SQL Techniques Using Analytic FunctionsZohar Elkayam
Session from ILOUG I presented in May, 2016
Even though DBAs and developers are writing SQL queries every day, it seems that advanced SQL techniques such as multi-dimension aggregation and analytic functions are still relatively remain unknown. In this session, we will explore some of the common real-world usages for analytic function, and understand how to take advantage of this great and useful tool. We will deep dive into ranking based on values and groups; understand aggregation of multiple dimensions without a group by; see how to do inter-row calculations, and much-much more…
Together we will see how we can unleash the power of analytics using Oracle 11g best practices and Oracle 12c new features.
This document introduces common table expressions (CTE) in T-SQL. It provides guidelines for creating and using both regular and recursive CTEs, including syntax, allowed/disallowed clauses, and handling of remote tables and cursors. Examples are also provided of a simple CTE, multiple CTE definitions, and a recursive CTE to display multiple recursion levels.
The document discusses analytic functions in SQL Server. It explains that analytic functions allow calculations on a set of rows and return a value for each row. Some common analytic functions include SUM, COUNT, MIN, MAX, RANK, and LEAD/LAG. These functions can be used with a PARTITION BY clause to perform the calculation separately over groups of rows.
Obtaining, Scrubbing, and Exploring Data at the Command Line by Jeroen Janssens Hakka Labs
Data scientists love to create exciting data visualizations and insightful models. However, before they get to that point, usually much effort goes into obtaining, scrubbing, and exploring the required data. In this presentation, Jeroen Janssens from YPlan,gives insight into the *nix command line. Although it was invented decades ago, it remains a powerful environment for many data science tasks. It provides a read-eval-print loop (REPL) that is often much more convenient for exploratory data analysis than the edit-compile-run-debug cycle associated with scripts or even programs. Even if you're already comfortable processing data with, for example, R or Python, being able to also leverage the power of the command line can make any data scientist more efficient.
ITCamp 2013 - Cristian Lefter - Transact-SQL from 0 to SQL Server 2012ITCamp
This document contains summaries of new features in various versions of Microsoft SQL Server from 2000 to 2012. It begins with a brief history of SQL and an overview of basic database concepts. Each major version is then discussed in its own section, with new syntax, functions, and capabilities highlighted at a high level. The document concludes with a recommendation to learn more about SQL Server memory-optimized tables and attending additional training.
The document provides information on various open source charting and graphing libraries including Google Chart Tools, Sencha Ext JS, Protovis, Highcharts, D3, RGraph, and others. For each library, it lists the URL, demo site, programming languages used, and license type. The libraries covered allow for creating different types of charts and graphs like bubble charts, motion charts, scatter plots, pie charts, radar charts, and more.
Required for certification, window functions are powerful analytic functions built into SQL Server. SQL Server 2005 introduced the core window ranking functions, and SQL Server 2012 added time and statistical percentage window functions. These functions allow for advanced variable creation, and are of direct benefit to people creating features for data science. This talk will also recommend further reading on this topic.
Exploring Advanced SQL Techniques Using Analytic FunctionsZohar Elkayam
Session from ILOUG I presented in May, 2016
Even though DBAs and developers are writing SQL queries every day, it seems that advanced SQL techniques such as multi-dimension aggregation and analytic functions are still relatively remain unknown. In this session, we will explore some of the common real-world usages for analytic function, and understand how to take advantage of this great and useful tool. We will deep dive into ranking based on values and groups; understand aggregation of multiple dimensions without a group by; see how to do inter-row calculations, and much-much more…
Together we will see how we can unleash the power of analytics using Oracle 11g best practices and Oracle 12c new features.
This document introduces common table expressions (CTE) in T-SQL. It provides guidelines for creating and using both regular and recursive CTEs, including syntax, allowed/disallowed clauses, and handling of remote tables and cursors. Examples are also provided of a simple CTE, multiple CTE definitions, and a recursive CTE to display multiple recursion levels.
Make your data dance: PIVOT, UNPIVOT & GROUP BY extensionsstewashton
This document discusses using UNPIVOT, PIVOT and GROUP BY extensions in SQL to transform and summarize data in various ways. Specifically, it shows how to:
1) Use UNPIVOT to transform columns into rows and PIVOT to transform rows into columns.
2) Use GROUP BY with ROLLUP, CUBE and GROUPING SETS functions to generate subtotals and totals across multiple levels or dimensions of data.
3) Apply techniques like UNPIVOT, PIVOT and GROUP BY to real-world sales data to transform it into a spreadsheet-like format with rows, columns, subtotals and totals.
This document is a shuttling proposal submitted by a transportation company to a customer that requires transportation for thousands of people for conferences and tourist excursions. The proposal outlines the company's services, pricing for different vehicles, coverage areas, certifications and team. It provides a specialized package for the customer's transportation needs that includes buses and luxury vans.
AOL Advertising on Price/Volume Analytics for Advanced Bid Optimization and I...Brad Terrell
Managing the yield performance of large advertising networks, such as the Advertising.com network, requires a soundly structured approach. One approach is to interpret advertising inventory as a commodity and the network as an exchange. In such, analysis tools and techniques based on established practices of economic modeling can be used to help optimize yield and improve media planning. One such tool is the price/volume forecast generator. While interpreting a price/volume forecast is relatively straightforward, creating an accurate forecast is challenging both from an algorithm and engineering perspective. This presentation will provide an overview of AOL Advertising's experience on how to construct and use price/volume forecasts. This slide deck is also available for download from the ad:tech website here: http://www.ad-tech.com/ny/presentations/.
The document discusses the marketing communications strategies and promotional campaigns of an automotive company from 2006-2007. It analyzes the results of previous campaigns and makes recommendations for upcoming campaigns. Key points include:
- Past competitions and promotions from 2005-2006 were very successful, generating millions in sales.
- The company will implement two major promotional campaigns between May-July 2007 and Nov 2007-Feb 2008 with prizes, advertising, and point-of-sale materials to continue growing the brand.
- The proposed campaigns will continue an "automotive" theme with prizes like adventure trips and portable navigation devices to appeal to customers and position the company as technologically advanced.
Sample Europe Shampoo Bar Market Report 2022 - Cognitive Market Research.docxCognitive Market Research
Europe Shampoo Bar Market Report 2022 Report Link- https://www.cognitivemarketresearch.com/Europe-Shampoo-Bar-Market-Report Cognitive Market Research provides detailed analysis of Europe Shampoo Bar in our recently published report titled, "Europe Shampoo Bar 2022" The market study focuses on industry dynamics including driving factors to provide the key elements fueling the current market growth. The report also identifies restraints and opportunities to identify high growth segments involved in the Europe Shampoo Bar market. Key industrial factors such as macroeconomic and microeconomic factors are studied in detail with help of PESTEL analysis in order to have a holistic view of factors impacting Europe Shampoo Bar market growth across the globe. Market growth is forecasted with the help of complex algorithms such as regression analysis, sentiment analysis of end-users, etc. #EuropeShampooBarReport #EuropeShampooBarMarket #EuropeShampooBarMarketForecast #EuropeShampooBarMarketStatus #EuropeShampooBarMarket2022
Europe Shampoo Bar Market Report 2022
Report Link- https://www.cognitivemarketresearch.com/Europe-Shampoo-Bar-Market-Report
Cognitive Market Research provides detailed analysis of Europe Shampoo Bar in our recently published report titled, "Europe Shampoo Bar 2022" The market study focuses on industry dynamics including driving factors to provide the key elements fueling the current market growth. The report also identifies restraints and opportunities to identify high growth segments involved in the Europe Shampoo Bar market. Key industrial factors such as macroeconomic and microeconomic factors are studied in detail with help of PESTEL analysis in order to have a holistic view of factors impacting Europe Shampoo Bar market growth across the globe. Market growth is forecasted with the help of complex algorithms such as regression analysis, sentiment analysis of end-users, etc. #EuropeShampooBarReport #EuropeShampooBarMarket #EuropeShampooBarMarketForecast #EuropeShampooBarMarketStatus
UEFA Champions League Finals - Atletico Madrid vs Real Madrid on Social MediaUnmetric
Check out which of the teams that made it to the final of the Champions League wins the competition on social media. Get access to posts and their corresponding social media metrics here.
Make your data dance: PIVOT and GROUP BY in Oracle SQLstewashton
This document summarizes a presentation titled "Make your Data Dance: UNPIVOT, PIVOT and GROUP BY Extensions" given by Stew Ashton at the DOAG 2018 conference. The presentation demonstrates how to use the UNPIVOT, PIVOT, and GROUP BY clauses in SQL to transform data between row-column formats, calculate subtotals and grand totals, and generate spreadsheet-like reports from transactional data. Examples using sales data illustrate techniques for pivoting, transposing, and grouping data at multiple levels to provide summary views.
The document lists various projects and iterations for creative assets created by Hoover's including icons, buttons, directories, newsletters, advertisements, reports, emails, signage, and collateral. Most projects went through multiple rounds of revisions and optimizations before being finalized.
This document contains contact information and a resume for Robert Pagan listing his experience as a Creative Manager and Production Manager. It also includes details of a job for client Cesar on a military promotion with specifications for the project such as trim size and safety area. The final part shows an example of a coupon that was created for the promotion.
This document discusses cost-volume-profit (CVP) analysis and how it can be used to answer questions about break-even point, sales volume needed to earn a profit target, expected profit at a given sales volume, and how changes in variables affect profits. Specifically, it addresses how to calculate break-even point, sales volume needed to earn a desired profit, and profit expected given a sales volume. It also discusses how changes in price, costs, output, or sales mix can impact break-even point, target income, and profit potential using CVP analysis tools like the breakeven graph. An example analyzing different cost structures for selling software at a fair is provided.
How Columnar Databases Support Modern AnalyticsDATAVERSITY
The increased requirements of modern analytical workloads – querying billions of rows on demand, in real time and in unforeseen ways – is a challenge for traditional databases because they’re optimized for transactional workloads (e.g., point and range queries with indexes).
A transactional query may return every column in a single row whereas an analytical query may aggregate a single column in every row. Thus, it is far more efficient to store data by column rather than by row. In addition, the use of distributed data and massively parallel processing enables columnar databases to support scalable, high-performance analytics.
In this webinar, we will use the architecture of MariaDB AX to explain how columnar storage and massively parallel processing work, and how they enable columnar databases to query billions of rows in real time, and with the full power of SQL – a challenge for Apache Hadoop/Hive.
This document provides instructions for inputting sales for hawker channel outlets in the DMS system. It includes prerequisites for setting up a dummy salesman and outlet mapping. The steps shown are for navigating to the billing section in DMS, searching for and selecting the appropriate outlet and salesman, adding product SKUs to an invoice, and saving the invoice. It also provides instructions for checking the hawker sales in the RSR reporting tool by selecting appropriate filters for location, product, date range, town type and retail type.
The SELECT statement in SQLite allows users to retrieve data from database tables. Some key functionality includes:
1) SELECT * retrieves all columns and rows while SELECT column1, column2 retrieves specific columns.
2) LIMIT and OFFSET can restrict the number of rows returned and skip rows.
3) WHERE filters rows by column values like WHERE column = 'value'.
4) ORDER BY sorts the results. ASC is ascending, DESC is descending.
5) GROUP BY groups rows and DISTINCT removes duplicate rows. Aggregate functions like SUM can operate on groups.
6) JOIN combines columns from two or more tables based on common columns.
1. Shelf ready packaging (SRP) provides benefits for both retailers and manufacturers by reducing costs and out-of-stock items while creating a feeling of abundant choice for customers.
2. SRP projects between SCA Packaging and major Russian retailers and suppliers aim to implement SRP designs that meet ergonomic requirements for easy identification, storage, and display.
3. Initial results from SRP implementations show cost reductions for packaging that outweigh decreased return losses, indicating the mutual advantages of SRP for improving retail operations and sales.
1. The document describes the FVDI ABRITES Commander, a diagnostic tool for Mercedes-Benz and other vehicles. It lists the tool's supported languages, update process, and supported systems.
2. The tool provides functions like reading fault codes, actuator tests, control unit adaptations, and special functions like mileage recalibration and programming keys.
3. It also lists additional special functions including reading/writing ECU flash and EEPROM, airbag data manipulation, and electrical steering lock functions.
1. The document describes the FVDI ABRITES Commander, a diagnostic tool for Mercedes-Benz and other vehicles. It lists the tool's supported languages and software version.
2. The tool provides functions like reading fault codes, scanning control units, actuator tests, and special functions like mileage recalibration and programming keys.
3. It also allows reading and writing to EEPROMs of various control modules, as well as functions for airbags, transmissions, and more.
The document describes the FVDI ABRITES Commander, an automotive diagnostic tool. It supports many Mercedes-Benz models from 1995 to present, allowing functions like fault code reading, actuator testing, control unit adaptations, and special functions like mileage recalibration and programming keys. The tool has an English interface and supports updates through the manufacturer. It provides comprehensive diagnostics and programming capabilities for Mercedes vehicles.
This document provides an overview of the CPS/Enterprise 2010 business solutions suite. It describes how the integrated modules can help companies streamline business processes, implement effective IT systems, and invest in proven solutions. The core modules cover areas like sales, production, warehouse management and finance. Implementation helps optimize operations, enhance competitiveness and reduce costs. The company has 18 years of experience developing solutions for specific industries and is committed to long-term customer partnerships.
This document summarizes a market research report from Canadean about whiskey consumption in Colombia. The report provides historic and forecast data on whiskey volume and value in Colombia from 2006 to 2016, segmented by category, channel, price, and alcoholic strength. It also analyzes consumption of specific whiskey types like American, Irish, and Scotch whiskey. The document aims to give an overview of whiskey category trends and market players in Colombia.
External Tables - not just loading a csv fileKim Berg Hansen
Giving an overview of many of the details of the external table syntax in Oracle that enables you from SQL to access files that reside outside the database
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...Kim Berg Hansen
Revised version of the presentation - as presented at #POUG2018.
About problems that can occur if NLS_LANG is not set correctly, which may lead to corrupt data.
About different NLS settings and related topics, collation, and the use of DMU to migrate to UTF or check for corrupt text.
Make your data dance: PIVOT, UNPIVOT & GROUP BY extensionsstewashton
This document discusses using UNPIVOT, PIVOT and GROUP BY extensions in SQL to transform and summarize data in various ways. Specifically, it shows how to:
1) Use UNPIVOT to transform columns into rows and PIVOT to transform rows into columns.
2) Use GROUP BY with ROLLUP, CUBE and GROUPING SETS functions to generate subtotals and totals across multiple levels or dimensions of data.
3) Apply techniques like UNPIVOT, PIVOT and GROUP BY to real-world sales data to transform it into a spreadsheet-like format with rows, columns, subtotals and totals.
This document is a shuttling proposal submitted by a transportation company to a customer that requires transportation for thousands of people for conferences and tourist excursions. The proposal outlines the company's services, pricing for different vehicles, coverage areas, certifications and team. It provides a specialized package for the customer's transportation needs that includes buses and luxury vans.
AOL Advertising on Price/Volume Analytics for Advanced Bid Optimization and I...Brad Terrell
Managing the yield performance of large advertising networks, such as the Advertising.com network, requires a soundly structured approach. One approach is to interpret advertising inventory as a commodity and the network as an exchange. In such, analysis tools and techniques based on established practices of economic modeling can be used to help optimize yield and improve media planning. One such tool is the price/volume forecast generator. While interpreting a price/volume forecast is relatively straightforward, creating an accurate forecast is challenging both from an algorithm and engineering perspective. This presentation will provide an overview of AOL Advertising's experience on how to construct and use price/volume forecasts. This slide deck is also available for download from the ad:tech website here: http://www.ad-tech.com/ny/presentations/.
The document discusses the marketing communications strategies and promotional campaigns of an automotive company from 2006-2007. It analyzes the results of previous campaigns and makes recommendations for upcoming campaigns. Key points include:
- Past competitions and promotions from 2005-2006 were very successful, generating millions in sales.
- The company will implement two major promotional campaigns between May-July 2007 and Nov 2007-Feb 2008 with prizes, advertising, and point-of-sale materials to continue growing the brand.
- The proposed campaigns will continue an "automotive" theme with prizes like adventure trips and portable navigation devices to appeal to customers and position the company as technologically advanced.
Sample Europe Shampoo Bar Market Report 2022 - Cognitive Market Research.docxCognitive Market Research
Europe Shampoo Bar Market Report 2022 Report Link- https://www.cognitivemarketresearch.com/Europe-Shampoo-Bar-Market-Report Cognitive Market Research provides detailed analysis of Europe Shampoo Bar in our recently published report titled, "Europe Shampoo Bar 2022" The market study focuses on industry dynamics including driving factors to provide the key elements fueling the current market growth. The report also identifies restraints and opportunities to identify high growth segments involved in the Europe Shampoo Bar market. Key industrial factors such as macroeconomic and microeconomic factors are studied in detail with help of PESTEL analysis in order to have a holistic view of factors impacting Europe Shampoo Bar market growth across the globe. Market growth is forecasted with the help of complex algorithms such as regression analysis, sentiment analysis of end-users, etc. #EuropeShampooBarReport #EuropeShampooBarMarket #EuropeShampooBarMarketForecast #EuropeShampooBarMarketStatus #EuropeShampooBarMarket2022
Europe Shampoo Bar Market Report 2022
Report Link- https://www.cognitivemarketresearch.com/Europe-Shampoo-Bar-Market-Report
Cognitive Market Research provides detailed analysis of Europe Shampoo Bar in our recently published report titled, "Europe Shampoo Bar 2022" The market study focuses on industry dynamics including driving factors to provide the key elements fueling the current market growth. The report also identifies restraints and opportunities to identify high growth segments involved in the Europe Shampoo Bar market. Key industrial factors such as macroeconomic and microeconomic factors are studied in detail with help of PESTEL analysis in order to have a holistic view of factors impacting Europe Shampoo Bar market growth across the globe. Market growth is forecasted with the help of complex algorithms such as regression analysis, sentiment analysis of end-users, etc. #EuropeShampooBarReport #EuropeShampooBarMarket #EuropeShampooBarMarketForecast #EuropeShampooBarMarketStatus
UEFA Champions League Finals - Atletico Madrid vs Real Madrid on Social MediaUnmetric
Check out which of the teams that made it to the final of the Champions League wins the competition on social media. Get access to posts and their corresponding social media metrics here.
Make your data dance: PIVOT and GROUP BY in Oracle SQLstewashton
This document summarizes a presentation titled "Make your Data Dance: UNPIVOT, PIVOT and GROUP BY Extensions" given by Stew Ashton at the DOAG 2018 conference. The presentation demonstrates how to use the UNPIVOT, PIVOT, and GROUP BY clauses in SQL to transform data between row-column formats, calculate subtotals and grand totals, and generate spreadsheet-like reports from transactional data. Examples using sales data illustrate techniques for pivoting, transposing, and grouping data at multiple levels to provide summary views.
The document lists various projects and iterations for creative assets created by Hoover's including icons, buttons, directories, newsletters, advertisements, reports, emails, signage, and collateral. Most projects went through multiple rounds of revisions and optimizations before being finalized.
This document contains contact information and a resume for Robert Pagan listing his experience as a Creative Manager and Production Manager. It also includes details of a job for client Cesar on a military promotion with specifications for the project such as trim size and safety area. The final part shows an example of a coupon that was created for the promotion.
This document discusses cost-volume-profit (CVP) analysis and how it can be used to answer questions about break-even point, sales volume needed to earn a profit target, expected profit at a given sales volume, and how changes in variables affect profits. Specifically, it addresses how to calculate break-even point, sales volume needed to earn a desired profit, and profit expected given a sales volume. It also discusses how changes in price, costs, output, or sales mix can impact break-even point, target income, and profit potential using CVP analysis tools like the breakeven graph. An example analyzing different cost structures for selling software at a fair is provided.
How Columnar Databases Support Modern AnalyticsDATAVERSITY
The increased requirements of modern analytical workloads – querying billions of rows on demand, in real time and in unforeseen ways – is a challenge for traditional databases because they’re optimized for transactional workloads (e.g., point and range queries with indexes).
A transactional query may return every column in a single row whereas an analytical query may aggregate a single column in every row. Thus, it is far more efficient to store data by column rather than by row. In addition, the use of distributed data and massively parallel processing enables columnar databases to support scalable, high-performance analytics.
In this webinar, we will use the architecture of MariaDB AX to explain how columnar storage and massively parallel processing work, and how they enable columnar databases to query billions of rows in real time, and with the full power of SQL – a challenge for Apache Hadoop/Hive.
This document provides instructions for inputting sales for hawker channel outlets in the DMS system. It includes prerequisites for setting up a dummy salesman and outlet mapping. The steps shown are for navigating to the billing section in DMS, searching for and selecting the appropriate outlet and salesman, adding product SKUs to an invoice, and saving the invoice. It also provides instructions for checking the hawker sales in the RSR reporting tool by selecting appropriate filters for location, product, date range, town type and retail type.
The SELECT statement in SQLite allows users to retrieve data from database tables. Some key functionality includes:
1) SELECT * retrieves all columns and rows while SELECT column1, column2 retrieves specific columns.
2) LIMIT and OFFSET can restrict the number of rows returned and skip rows.
3) WHERE filters rows by column values like WHERE column = 'value'.
4) ORDER BY sorts the results. ASC is ascending, DESC is descending.
5) GROUP BY groups rows and DISTINCT removes duplicate rows. Aggregate functions like SUM can operate on groups.
6) JOIN combines columns from two or more tables based on common columns.
1. Shelf ready packaging (SRP) provides benefits for both retailers and manufacturers by reducing costs and out-of-stock items while creating a feeling of abundant choice for customers.
2. SRP projects between SCA Packaging and major Russian retailers and suppliers aim to implement SRP designs that meet ergonomic requirements for easy identification, storage, and display.
3. Initial results from SRP implementations show cost reductions for packaging that outweigh decreased return losses, indicating the mutual advantages of SRP for improving retail operations and sales.
1. The document describes the FVDI ABRITES Commander, a diagnostic tool for Mercedes-Benz and other vehicles. It lists the tool's supported languages, update process, and supported systems.
2. The tool provides functions like reading fault codes, actuator tests, control unit adaptations, and special functions like mileage recalibration and programming keys.
3. It also lists additional special functions including reading/writing ECU flash and EEPROM, airbag data manipulation, and electrical steering lock functions.
1. The document describes the FVDI ABRITES Commander, a diagnostic tool for Mercedes-Benz and other vehicles. It lists the tool's supported languages and software version.
2. The tool provides functions like reading fault codes, scanning control units, actuator tests, and special functions like mileage recalibration and programming keys.
3. It also allows reading and writing to EEPROMs of various control modules, as well as functions for airbags, transmissions, and more.
The document describes the FVDI ABRITES Commander, an automotive diagnostic tool. It supports many Mercedes-Benz models from 1995 to present, allowing functions like fault code reading, actuator testing, control unit adaptations, and special functions like mileage recalibration and programming keys. The tool has an English interface and supports updates through the manufacturer. It provides comprehensive diagnostics and programming capabilities for Mercedes vehicles.
This document provides an overview of the CPS/Enterprise 2010 business solutions suite. It describes how the integrated modules can help companies streamline business processes, implement effective IT systems, and invest in proven solutions. The core modules cover areas like sales, production, warehouse management and finance. Implementation helps optimize operations, enhance competitiveness and reduce costs. The company has 18 years of experience developing solutions for specific industries and is committed to long-term customer partnerships.
This document summarizes a market research report from Canadean about whiskey consumption in Colombia. The report provides historic and forecast data on whiskey volume and value in Colombia from 2006 to 2016, segmented by category, channel, price, and alcoholic strength. It also analyzes consumption of specific whiskey types like American, Irish, and Scotch whiskey. The document aims to give an overview of whiskey category trends and market players in Colombia.
External Tables - not just loading a csv fileKim Berg Hansen
Giving an overview of many of the details of the external table syntax in Oracle that enables you from SQL to access files that reside outside the database
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...Kim Berg Hansen
Revised version of the presentation - as presented at #POUG2018.
About problems that can occur if NLS_LANG is not set correctly, which may lead to corrupt data.
About different NLS settings and related topics, collation, and the use of DMU to migrate to UTF or check for corrupt text.
When 7-bit ASCII ain't enough - about NLS, Collation, Charsets, Unicode and suchKim Berg Hansen
This document discusses character sets, encodings, and national language support (NLS) settings in Oracle databases. It begins with an introduction and agenda, then covers character sets and encodings like ASCII, ISO-8859, Windows codepages, and Unicode. It discusses database and national character sets. It also covers byte versus character length semantics, viewing NLS parameter values, and setting the session NLS environment.
Presentation on Analytic View syntax - a new feature in Oracle 12.2 that works like a "virtual" OLAP cube, so you can dimensionally query your relational data in real-time without copying to a datawarehouse.
Various use cases for Oracle database version 12c MATCH_RECOGNIZE data pattern matching functionality, not only for classic pattern matching like finding W patterns in stock ticker data, but also used for more general purpose SQL as "declarative analytics." Presentation given at OUGN Spring Conference 2016.
Using Oracle database and Oracle SQL to retrieve XML and JSON from for example webservices, store XML and JSON in the database, query XML and JSON with SELECT as relational data, create XML and JSON in various manners from relational data. Presentation given at OUGN Spring Conference 2016.
This document describes using analytic functions in SQL to optimize warehouse picking based on the FIFO principle. It shows how to:
1. Join order lines to inventory data and order by purchase date to pick oldest items first.
2. Use an analytic sum to calculate a running total of quantities picked to determine when enough has been picked to fulfill an order.
3. Generate a picklist that orders picks by location to minimize travel within the warehouse.
4. Add aisle and warehouse information to further optimize the pick route by picking contiguous aisles and positions.
Real cases of indispensability of Oracle SQL analytic functionsKim Berg Hansen
Kim Berg Hansen will present on real cases where analytic functions in SQL were indispensably useful. Some of the cases covered include analyzing top selling items, efficient order picking using a FIFO principle, optimizing picking routes, measuring picking efficiency, sales forecasting, and forecasting inventory needs. The presentation argues that analytic functions allow SQL queries to efficiently operate across result sets rather than single rows, enabling new types of analyses.
The Building Blocks of QuestDB, a Time Series Databasejavier ramirez
Talk Delivered at Valencia Codes Meetup 2024-06.
Traditionally, databases have treated timestamps just as another data type. However, when performing real-time analytics, timestamps should be first class citizens and we need rich time semantics to get the most out of our data. We also need to deal with ever growing datasets while keeping performant, which is as fun as it sounds.
It is no wonder time-series databases are now more popular than ever before. Join me in this session to learn about the internal architecture and building blocks of QuestDB, an open source time-series database designed for speed. We will also review a history of some of the changes we have gone over the past two years to deal with late and unordered data, non-blocking writes, read-replicas, or faster batch ingestion.
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeWalaa Eldin Moustafa
Dynamic policy enforcement is becoming an increasingly important topic in today’s world where data privacy and compliance is a top priority for companies, individuals, and regulators alike. In these slides, we discuss how LinkedIn implements a powerful dynamic policy enforcement engine, called ViewShift, and integrates it within its data lake. We show the query engine architecture and how catalog implementations can automatically route table resolutions to compliance-enforcing SQL views. Such views have a set of very interesting properties: (1) They are auto-generated from declarative data annotations. (2) They respect user-level consent and preferences (3) They are context-aware, encoding a different set of transformations for different use cases (4) They are portable; while the SQL logic is only implemented in one SQL dialect, it is accessible in all engines.
#SQL #Views #Privacy #Compliance #DataLake
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Data and AI
Round table discussion of vector databases, unstructured data, ai, big data, real-time, robots and Milvus.
A lively discussion with NJ Gen AI Meetup Lead, Prasad and Procure.FYI's Co-Found
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataKiwi Creative
Harness the power of AI-backed reports, benchmarking and data analysis to predict trends and detect anomalies in your marketing efforts.
Peter Caputa, CEO at Databox, reveals how you can discover the strategies and tools to increase your growth rate (and margins!).
From metrics to track to data habits to pick up, enhance your reporting for powerful insights to improve your B2B tech company's marketing.
- - -
This is the webinar recording from the June 2024 HubSpot User Group (HUG) for B2B Technology USA.
Watch the video recording at https://youtu.be/5vjwGfPN9lw
Sign up for future HUG events at https://events.hubspot.com/b2b-technology-usa/
End-to-end pipeline agility - Berlin Buzzwords 2024Lars Albertsson
We describe how we achieve high change agility in data engineering by eliminating the fear of breaking downstream data pipelines through end-to-end pipeline testing, and by using schema metaprogramming to safely eliminate boilerplate involved in changes that affect whole pipelines.
A quick poll on agility in changing pipelines from end to end indicated a huge span in capabilities. For the question "How long time does it take for all downstream pipelines to be adapted to an upstream change," the median response was 6 months, but some respondents could do it in less than a day. When quantitative data engineering differences between the best and worst are measured, the span is often 100x-1000x, sometimes even more.
A long time ago, we suffered at Spotify from fear of changing pipelines due to not knowing what the impact might be downstream. We made plans for a technical solution to test pipelines end-to-end to mitigate that fear, but the effort failed for cultural reasons. We eventually solved this challenge, but in a different context. In this presentation we will describe how we test full pipelines effectively by manipulating workflow orchestration, which enables us to make changes in pipelines without fear of breaking downstream.
Making schema changes that affect many jobs also involves a lot of toil and boilerplate. Using schema-on-read mitigates some of it, but has drawbacks since it makes it more difficult to detect errors early. We will describe how we have rejected this tradeoff by applying schema metaprogramming, eliminating boilerplate but keeping the protection of static typing, thereby further improving agility to quickly modify data pipelines without fear.
State of Artificial intelligence Report 2023kuntobimo2016
Artificial intelligence (AI) is a multidisciplinary field of science and engineering whose goal is to create intelligent machines.
We believe that AI will be a force multiplier on technological progress in our increasingly digital, data-driven world. This is because everything around us today, ranging from culture to consumer products, is a product of intelligence.
The State of AI Report is now in its sixth year. Consider this report as a compilation of the most interesting things we’ve seen with a goal of triggering an informed conversation about the state of AI and its implication for the future.
We consider the following key dimensions in our report:
Research: Technology breakthroughs and their capabilities.
Industry: Areas of commercial application for AI and its business impact.
Politics: Regulation of AI, its economic implications and the evolving geopolitics of AI.
Safety: Identifying and mitigating catastrophic risks that highly-capable future AI systems could pose to us.
Predictions: What we believe will happen in the next 12 months and a 2022 performance review to keep us honest.
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...sameer shah
"Join us for STATATHON, a dynamic 2-day event dedicated to exploring statistical knowledge and its real-world applications. From theory to practice, participants engage in intensive learning sessions, workshops, and challenges, fostering a deeper understanding of statistical methodologies and their significance in various fields."
University of New South Wales degree offer diploma Transcript
Data twisting
1. BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF
HAMBURG KOPENHAGEN LAUSANNE MÜNCHEN STUTTGART WIEN ZÜRICH
Data Twisting
OUGN Spring Seminar 10-12 March 2016
Kim Berg Hansen
Senior Consultant
2. • Danish geek
• SQL & PL/SQL developer since 2000
• Developer at Trivadis AG since 2016
http://www.trivadis.dk
• Oracle Certified Expert in SQL
• Oracle ACE
• Blogger at http://www.kibeha.dk
• SQL quizmaster at
http://plsqlchallenge.oracle.com
• Likes to cook
• Reads sci-fi
• Chairman of local chapter of
Danish Beer Enthusiasts
About me
Data Twisting2 3/30/2016
3. About Trivadis
Data Twisting3 3/30/2016
Trivadis is a market leader in IT consulting, system integration, solution engineering
and the provision of IT services focusing on and
technologies in Switzerland, Germany, Austria and Denmark.
We offer our services in the following strategic business fields:
Trivadis Services takes over the interacting operation of your IT systems.
O P E R A T I O N
5. Agenda for Data Twisting
Data Twisting5 3/30/2016
1. Why do we need to Twist, Shake, Rattle ‘n‘ Roll
2. Twist
UNPIVOT with single or multi-column dimensions
Unpivoting with row generators
3. Shake
PIVOT with single or multi-column dimensions, with or without grouping
Pivoting with GROUP BY and CASE
4. Rattle
Turning delimited data into columns and rows
ODCI dynamic table function parser
5. Roll
LISTAGG to turn rows into delimited data
Alternative methods for string aggregation
6. Coda
9. Beer
Wine
Rattle Delimited Data to Columns
Data Twisting9 3/30/2016
CategoryEMEAAMER
200000
10000
150000
25000
225000
17500
ASOCCategory;EMEA;AMER;ASOC
Beer;200000;150000;225000
Wine;10000;25000;17500
10. Rattle Delimited Data to Rows
Data Twisting10 3/30/2016
Category
BeerBeer
Type
PilsnerBeer
WineWine
AleStout
RedChampagne
TypeList
Pilsner;Ale;Stout
Red;Champagne
13. Single dimension and measure
Data Twisting13 3/30/2016
create table sales1 (
category varchar2(10)
, emea number
, amer number
, asoc number
);
insert into sales1 values ('Beer', 200000, 150000, 225000);
insert into sales1 values ('Wine', 10000, 25000, 17500);
Table of beverage sales with columns per region
14. Single dimension and measure
Data Twisting14 3/30/2016
select category, region, sales
from sales1
unpivot (
sales
for region in (
emea as 'EMEA'
, amer as 'AMER'
, asoc as 'ASOC'
)
)
order by category, region;
UNPIVOT create dimension REGION and measure SALES
CATEGORY REGI SALES
---------- ---- ----------
Beer AMER 150000
Beer ASOC 225000
Beer EMEA 200000
Wine AMER 25000
Wine ASOC 17500
Wine EMEA 10000
15. Single dimension and measure
Data Twisting15 3/30/2016
select category
, case n# when 1 then 'EMEA'
when 2 then 'AMER'
when 3 then 'ASOC'
end region
, case n# when 1 then emea
when 2 then amer
when 3 then asoc
end sales
from sales1
cross join (
select level n# from dual
connect by level <= 3
)
order by category, region;
Generate 3 rows - Cartesian join – CASE logic for dimension and measure
CATEGORY REGI SALES
---------- ---- ----------
Beer AMER 150000
Beer ASOC 225000
Beer EMEA 200000
Wine AMER 25000
Wine ASOC 17500
Wine EMEA 10000
16. Single dimension and measure
Data Twisting16 3/30/2016
with r (region) as (
select 'EMEA' from dual union all
select 'AMER' from dual union all
select 'ASOC' from dual
)
select category, region
, case region
when 'EMEA' then emea
when 'AMER' then amer
when 'ASOC' then asoc
end sales
from sales1
cross join r
order by category, region;
Generate 3 rows with dimension - Cartesian join – CASE logic for measure
CATEGORY REGI SALES
---------- ---- ----------
Beer AMER 150000
Beer ASOC 225000
Beer EMEA 200000
Wine AMER 25000
Wine ASOC 17500
Wine EMEA 10000
17. Multiple dimensions and measures
Data Twisting17 3/30/2016
create table sales2 (
category varchar2(10)
, dk_b2b_qty number , dk_b2b_amount number
, dk_b2c_qty number , dk_b2c_amount number
, uk_b2b_qty number , uk_b2b_amount number
, uk_b2c_qty number , uk_b2c_amount number
);
insert into sales2 values ('Beer', 500, 5000, 250, 2500, 100, 1000, 200, 2000);
insert into sales2 values ('Wine', 150, 3000, 200, 4000, 400, 8000, 300, 6000);
Table of beverage sales with qty and amount columns per country and channel
18. Multiple dimensions and measures
Data Twisting18 3/30/2016
select category, country, channel, qty, amount
from sales2
unpivot (
( qty, amount )
for ( country, channel )
in (
(dk_b2b_qty, dk_b2b_amount) as ('DK', 'B2B')
, (dk_b2c_qty, dk_b2c_amount) as ('DK', 'B2C')
, (uk_b2b_qty, uk_b2b_amount) as ('UK', 'B2B')
, (uk_b2c_qty, uk_b2c_amount) as ('UK', 'B2C')
)
)
order by category, country, channel;
UNPIVOT create dimensions COUNTRY, CHANNEL and measures QTY, AMOUNT
CATEGORY CO CHA QTY AMOUNT
---------- -- --- ----- -------
Beer DK B2B 500 5000
Beer DK B2C 250 2500
Beer UK B2B 100 1000
Beer UK B2C 200 2000
Wine DK B2B 150 3000
Wine DK B2C 200 4000
Wine UK B2B 400 8000
Wine UK B2C 300 6000
19. Single dimension and multiple measures
Data Twisting19 3/30/2016
select category, country_and_channel, qty, amount
from sales2
unpivot (
( qty, amount )
for ( country_and_channel )
in (
(dk_b2b_qty, dk_b2b_amount) as ('DK_B2B')
, (dk_b2c_qty, dk_b2c_amount) as ('DK_B2C')
, (uk_b2b_qty, uk_b2b_amount) as ('UK_B2B')
, (uk_b2c_qty, uk_b2c_amount) as ('UK_B2C')
)
)
order by category, country_and_channel;
UNPIVOT create dimension COUNTRY_AND_CHANNEL - measures QTY, AMOUNT
CATEGORY COUNTR QTY AMOUNT
---------- ------ ----- -------
Beer DK_B2B 500 5000
Beer DK_B2C 250 2500
Beer UK_B2B 100 1000
Beer UK_B2C 200 2000
Wine DK_B2B 150 3000
Wine DK_B2C 200 4000
Wine UK_B2B 400 8000
Wine UK_B2C 300 6000
20. Multiple dimensions and single measure
Data Twisting20 3/30/2016
select category, country, channel, amount
from sales2
unpivot (
( amount )
for ( country, channel )
in (
(dk_b2b_amount) as ('DK', 'B2B')
, (dk_b2c_amount) as ('DK', 'B2C')
, (uk_b2b_amount) as ('UK', 'B2B')
, (uk_b2c_amount) as ('UK', 'B2C')
)
)
order by category, country, channel;
UNPIVOT create dimensions COUNTRY, CHANNEL - measure AMOUNT
CATEGORY CO CHA AMOUNT
---------- -- --- ----------
Beer DK B2B 5000
Beer DK B2C 2500
Beer UK B2B 1000
Beer UK B2C 2000
Wine DK B2B 3000
Wine DK B2C 4000
Wine UK B2B 8000
Wine UK B2C 6000
22. Single dimension and measure
Data Twisting22 3/30/2016
create table sales3 (
category varchar2(10)
, region varchar2(10)
, sales number
);
insert into sales3 values ('Beer', 'EMEA', 200000);
insert into sales3 values ('Beer', 'AMER', 150000);
insert into sales3 values ('Beer', 'ASOC', 225000);
insert into sales3 values ('Wine', 'EMEA', 10000);
insert into sales3 values ('Wine', 'AMER', 25000);
insert into sales3 values ('Wine', 'ASOC', 17500);
Table of beverage sales per region
23. Single dimension and measure
Data Twisting23 3/30/2016
select category, emea, amer, asoc
from sales3
pivot (
sum(sales)
for region in (
'EMEA' as emea
, 'AMER' as amer
, 'ASOC' as asoc
)
)
order by category;
PIVOT create 3 columns for 3 dimension values and 1 measure
CATEGORY EMEA AMER ASOC
---------- ------- ------- -------
Beer 200000 150000 225000
Wine 10000 25000 17500
24. Single dimension and measure
Data Twisting24 3/30/2016
select category
, sum(case region
when 'EMEA' then sales
end) as emea
, sum(case region
when 'AMER' then sales
end) as amer
, sum(case region
when 'ASOC' then sales
end) as asoc
from sales3
group by category
order by category;
GROUP BY using CASE statement within SUM for each of the 3 dimension values
CATEGORY EMEA AMER ASOC
---------- ------- ------- -------
Beer 200000 150000 225000
Wine 10000 25000 17500
25. Single dimension and measure
Data Twisting25 3/30/2016
insert into sales3 values
('Beer', 'AMER', 25000);
commit;
select category, emea, amer, asoc
from sales3
pivot (
sum(sales)
for region in (
'EMEA' as emea
, 'AMER' as amer
, 'ASOC' as asoc
)
)
order by category;
Aggregations used for non-unique dimensions
CATEGORY EMEA AMER ASOC
---------- ------- ------- -------
Beer 200000 175000 225000
Wine 10000 25000 17500
26. Single dimension and multiple measures
Data Twisting26 3/30/2016
select *
from sales3
pivot (
sum(sales)
, count(*)
for region in (
'EMEA' as emea
, 'AMER' as amer
, 'ASOC' as asoc
)
)
order by category;
Columns are named <dim>_<measure> , so problem if no measure aliases
ERROR at line 1:
ORA-00918: column ambiguously defined
27. Single dimension and multiple measures
Data Twisting27 3/30/2016
CATEGORY EMEA_SALE EMEA_CNT AMER_SALE AMER_CNT ASOC_SALE ASOC_CNT
-------- --------- -------- --------- -------- --------- --------
Beer 200000 1 175000 2 225000 1
Wine 10000 1 25000 1 17500 1
select category, emea_sale, emea_cnt, amer_sale, amer_cnt, asoc_sale, asoc_cnt
from sales3
pivot (
sum(sales) as sale, count(*) as cnt
for region in (
'EMEA' as emea, 'AMER' as amer, 'ASOC' as asoc
)
)
order by category;
With measure aliases we get 3x2 columns named <dim>_<measure> combinations
28. Multiple dimensions and measures
Data Twisting28 3/30/2016
create table sales4 (
category varchar2(10)
, country varchar2(10)
, channel varchar2(10)
, qty number
, amount number
);
insert into sales4 values('Beer', 'DK', 'B2B', 500, 5000);
insert into sales4 values('Beer', 'DK', 'B2C', 250, 2500);
insert into sales4 values('Beer', 'UK', 'B2B', 100, 1000);
insert into sales4 values('Beer', 'UK', 'B2C', 200, 2000);
insert into sales4 values('Wine', 'DK', 'B2B', 150, 3000);
insert into sales4 values('Wine', 'DK', 'B2C', 200, 4000);
insert into sales4 values('Wine', 'UK', 'B2B', 400, 8000);
insert into sales4 values('Wine', 'UK', 'B2C', 300, 6000);
Table of beverage sales measured in qty and amount per country and channel
29. Multiple dimensions and measures
Data Twisting29 3/30/2016
CATEGORY DK_B2B_QTY DK_B2B_AMOUNT DK_B2C_QTY DK_B2C_AMOUNT UK_B2B_QTY UK_B2B_AMOUNT UK_B2C_QTY UK_B2C_AMOUNT
---------- ---------- ------------- ---------- ------------- ---------- ------------- ---------- -------------
Beer 500 5000 250 2500 100 1000 200 2000
Wine 150 3000 200 4000 400 8000 300 6000
select category, dk_b2b_qty, dk_b2b_amount, dk_b2c_qty, dk_b2c_amount
, uk_b2b_qty, uk_b2b_amount, uk_b2c_qty, uk_b2c_amount
from sales4 pivot (
sum(qty) as qty, sum(amount) as amount
for ( country, channel ) in ( ('DK', 'B2B') as dk_b2b
, ('DK', 'B2C') as dk_b2c
, ('UK', 'B2B') as uk_b2b
, ('UK', 'B2C') as uk_b2c )
) order by category;
With dimension and measure aliases we get (2x2)x2 columns
31. Delimited data to columns
Data Twisting31 3/30/2016
create table sales5 (
txt varchar2(100)
);
insert into sales5 values ('Beer;200000;150000;225000');
insert into sales5 values ('Wine;10000;25000;17500');
Table of beverage sales as semi-colon separated text
32. Delimited data to columns
Data Twisting32 3/30/2016
CATEGORY EMEA AMER ASOC
-------- ------ ------ ------
Beer 200000 150000 225000
Wine 10000 25000 17500
select substr(txt, 1, instr(txt,';') - 1) category
, substr(
txt, instr(txt,';') + 1, instr(txt,';',1,2) - instr(txt,';') -1
) emea
, substr(
txt, instr(txt,';',1,2) + 1, instr(txt,';',1,3) - instr(txt,';',1,2) - 1
) amer
, substr(txt, instr(txt,';',1,3) + 1) asoc
from sales5
order by category;
Using SUBSTR and INSTR
33. Delimited data to columns
Data Twisting33 3/30/2016
CATEGORY EMEA AMER ASOC
-------- ------ ------ ------
Beer 200000 150000 225000
Wine 10000 25000 17500
select regexp_substr(txt, '[^;]+', 1, 1) category
, regexp_substr(txt, '[^;]+', 1, 2) emea
, regexp_substr(txt, '[^;]+', 1, 3) amer
, regexp_substr(txt, '[^;]+', 1, 4) asoc
from sales5
order by category;
Using REGEXP_SUBSTR
34. Delimited data to rows
Data Twisting34 3/30/2016
create table beverages1 (
category varchar2(10)
, typelist varchar2(100)
);
insert into beverages1 values ('Beer', 'Pilsner;Ale;Stout');
insert into beverages1 values ('Wine', 'Red;Champagne');
Table of beverage types as semi-colon separated text
35. Delimited data to rows
Data Twisting35 3/30/2016
create type beverage_collection_type as table of varchar2(10);
/
create or replace function beverage_typelist_to_coll ( typelist in beverages1.typelist%type )
return beverage_collection_type pipelined
is
list_len pls_integer;
from_pos pls_integer;
to_pos pls_integer;
begin
list_len := length(typelist);
from_pos := 1;
loop
to_pos := nvl(nullif(instr(typelist, ';', from_pos), 0), list_len+1);
pipe row (substr(typelist, from_pos, to_pos-from_pos));
exit when to_pos > list_len;
from_pos := to_pos + 1;
end loop;
end beverage_typelist_to_coll;
/
Collection type and pipelined function to parse string and pipe out collection
36. Delimited data to rows
Data Twisting36 3/30/2016
select category
, column_value as beverage_type
from beverages1
, table(beverage_typelist_to_coll(typelist))
order by category, beverage_type;
Use pipelined table function within TABLE
CATEGORY BEVERAGE_T
-------- ----------
Beer Ale
Beer Pilsner
Beer Stout
Wine Champagne
Wine Red
37. Delimited data to rows
Data Twisting37 3/30/2016
select category
, regexp_substr(typelist, '[^;]+', 1, sub#) beverage_type
from beverages1
cross join lateral (
select level sub#
from dual
connect by level <= regexp_count(typelist, ';') + 1
)
order by category, beverage_type;
Generate count of delimiters + 1 rows per category (note: LATERAL requires 12c)
CATEGORY BEVERAGE_T
-------- ----------
Beer Ale
Beer Pilsner
Beer Stout
Wine Champagne
Wine Red
38. Delimited/structured data to rows and columns
Data Twisting38 3/30/2016
create table beverages2 (
category varchar2(10)
, typelist varchar2(100)
);
insert into beverages2 values ('Beer', 'Pilsner|Light;Ale|Medium;Stout|Dark');
insert into beverages2 values ('Wine', 'Red|Red;Champagne|Clear');
Table of beverage types and colors as semi-colon and pipe separated text
39. Delimited/structured data to rows and columns
Data Twisting39 3/30/2016
create or replace type delimited_col_row as object (
{globals}
, static function parser( {params} ) return anydataset pipelined using delimited_col_row
, static function odcitabledescribe( {params} ) return number
, static function odcitableprepare( {params} ) return number
, static function odcitablestart( {params} ) return number
, member function odcitablefetch( {params} ) return number
, member function odcitableclose( {params} ) return number
)
/
create or replace type body delimited_col_row as
{implementation}
end;
/
Object type implementing ODCI functions (complete code in script: http://bit.ly/kibeha_datatwist_sql)
40. Delimited/structured data to rows and columns
Data Twisting40 3/30/2016
select category, beverage_type, color
from beverages2
, table(
delimited_col_row.parser(
typelist
, 'BEVERAGE_TYPE|VARCHAR2(10);COLOR|VARCHAR2(10)'
, '|'
, ';'
)
) type_and_color
order by category, beverage_type;
Use ODCI parser function within TABLE – Column definition string must be a literal
CATEGORY BEVERAGE_T COLOR
-------- ---------- ----------
Beer Ale Medium
Beer Pilsner Light
Beer Stout Dark
Wine Champagne Clear
Wine Red Red
42. Rows to delimited data
Data Twisting42 3/30/2016
create table beverages3 (
category varchar2(10)
, beverage_type varchar2(10)
);
insert into beverages3 values ('Beer', 'Pilsner');
insert into beverages3 values ('Beer', 'Ale');
insert into beverages3 values ('Beer', 'Stout');
insert into beverages3 values ('Wine', 'Red');
insert into beverages3 values ('Wine', 'Champagne');
Table of beverage types per category
43. Rows to delimited data
Data Twisting43 3/30/2016
select category
, listagg(beverage_type, ';')
within group (
order by beverage_type
) typelist
from beverages3
group by category
order by category;
LISTAGG built-in aggregate function (11.2)
CATEGORY TYPELIST
-------- --------------------
Beer Ale;Pilsner;Stout
Wine Champagne;Red
44. Rows to delimited data
Data Twisting44 3/30/2016
create type beverage_collection_type as table of varchar2(10);
/
create or replace function beverage_typecoll_to_string ( typecoll in beverage_collection_type )
return varchar2
is
type_string varchar2(4000);
begin
for idx in typecoll.first .. typecoll.last loop
if idx = typecoll.first then
type_string := typecoll(idx);
else
type_string := type_string || ';' || typecoll(idx);
end if;
end loop;
return type_string;
end beverage_typecoll_to_string;
/
Create collection type and a function to turn collection into delimited string
45. Rows to delimited data
Data Twisting45 3/30/2016
select category
, beverage_typecoll_to_string(
cast(
collect(
beverage_type
order by beverage_type
)
as beverage_collection_type
)
) typelist
from beverages3
group by category
order by category;
Use COLLECT to aggregate into collection, then call function to create string
CATEGORY TYPELIST
-------- --------------------
Beer Ale;Pilsner;Stout
Wine Champagne;Red
46. Rows to delimited data
Data Twisting46 3/30/2016
create or replace type string_agg_type as object(
total varchar2(4000),
static function ODCIAggregateInitialize( {params} ) return number,
member function ODCIAggregateIterate( {params} ) return number,
member function ODCIAggregateTerminate( {params} ) return number,
member function ODCIAggregateMerge( {params} ) return number );
/
create or replace type body string_agg_type
{implementation}
end;
/
create or replace function stragg( input varchar2 ) return varchar2
parallel_enable aggregate using string_agg_type;
/
Tom Kyte STRAGG function using ODCI implementation of user aggregate function
https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:2196162600402
47. Rows to delimited data
Data Twisting47 3/30/2016
select category
, stragg(beverage_type) typelist
from beverages3
group by category
order by category;
Use STRAGG like any aggregate – Note unlike LISTAGG this can not ORDER BY
CATEGORY TYPELIST
-------- --------------------
Beer Pilsner;Stout;Ale
Wine Red;Champagne
49. We Can Boogie
Data Twisting49 3/30/2016
Twist Columns to Rows
– UNPIVOT or dummy row generators
Shake Rows to Columns
– PIVOT or GROUP BY with CASE
Rattle Delimited Data to Columns or Rows
– Parse delimited data
Roll Rows to Delimited Data
– LISTAGG or other string aggregation techniques
Boogie!
50. Data Twisting50 3/30/2016
Links
This presentation PowerPoint http://bit.ly/kibeha_datatwist_pptx
Script with all examples from this presentation http://bit.ly/kibeha_datatwist_sql
51. Questions & Answers
Kim Berg Hansen
Senior Consultant
kim.berghansen@trivadis.com
3/30/2016 Data Twisting51
http://bit.ly/kibeha_datatwist_pptx
http://bit.ly/kibeha_datatwist_sql