Before You Begin
This tutorial shows you how to create joins in a dataset with multiple tables in Oracle Analytics.
Background
When you create a dataset with multiple tables where relationships are defined between the tables, Oracle Analytics automatically creates the joins between the tables in the dataset. When you create a dataset from multiple connections and schemas, you might need to define the joins between tables.
In some cases, the joins aren't created because columns use different data types or different columns names. You might need to transform data in existing columns or create columns to use for joins between tables.
What Do You Need?
- Access to Oracle Analytics Cloud or Oracle Analytics Desktop.
- Ability to connect a relational data source such as Oracle Autonomous Data Warehouse or Oracle Database.
- Access to a sample schema to perform the steps in this tutorial, see Installing Sample Schemas
- Ability to run a script using SQL Developer or a related tool.
Create a CHANNELS_VIEW Table
- Open SQL Developer, and connect to a database with SH schema as SH user or connect as a database user with the ability to create views in the SH schema.
- Select the SH schema, and then run the following script to create or replace the
sh.CHANNELS
view:CREATE OR REPLACE view sh.CHANNELS_VIEW as ( SELECT 'ID-'||channel_id as channel_num, channel_desc, channel_class, channel_class_id, channel_total, channel_total_id FROM sh.channels);
You use the CHANNELS_VIEW in the dataset in the next sections.
Create a Dataset from a Connection
In this section, you use the drag and drop approach to create joins. The SALES, CUSTOMERS, PRODUCTS, TIMES, and CHANNELS_VIEW tables from the SH schema comprise the dataset.
When creating a dataset with multiple tables, start with the fact or transaction table, and then add other tables.
- Sign in to Oracle Analytics.
- On the Home page, click Create, and then click Dataset.
- In Create Dataset, select a connection that supports datasets with multiple tables to use as the source.
- In the Connections panel, expand the SH schema, and then drag the SALES table to the Join Diagram.
- Hold down the Ctrl key, select the CHANNELS_VIEW, CUSTOMERS, PRODUCTS, and TIMES tables from the SH schema, and then drag them to the SALES table to create the joins.
Oracle Analytics didn't find matching columns between the SALES and CHANNELS_VIEW tables.
- If necessary, select CHANNELS_VIEW and drop it onto the SALES table.
When there's a table in the dataset that isn't joined, you need to implement a solution or remove the table to save the dataset.
Review Table Columns
This section reviews the columns in the tables with the incomplete join.
- In the Join Diagram, click the incomplete join .
- In the Join dialog, click Select a column under the SALES table name.
In the SALES table, the CHANNEL_ID column is a measure.
- In the Join dialog, click Select a column under the CHANNELS_VIEW table name.
In this example, the CHANNELS_VIEW table uses CHANNEL_NUM as its primary key. CHANNEL_NUM doesn't match the SALES table that uses CHANNEL_ID.
Transform Data to Create a Join
This section shows one way to change the data definition of a column to complete the required join.
This example splits the CHANNEL_NUM column in the CHANNELS_VIEW table to remove ID- from the CHANNEL_NUM column, and creates a column that is renamed to match the CHANNEL_ID column in the SALES table.
- Click the CHANNELS_VIEW tab.
- Right-click the CHANNELS_NUM column, select Options, and then select Split.
- In Split Column, select Dash (-) in the Delimiter field. In Number of parts to create, enter
2
. In New column 2 name, enter aCHANNEL_ID
. - Click Add Step.
- Click the Join Diagram. Click the incomplete join between the SALES and CHANNELS_VIEW tables. In the Join dialog under SALES, click Select a column, and then select CHANNEL_ID.
- In the Join dialog under CHANNELS_VIEW, click Select a column, and then select CHANNEL_ID.
The CHANNEL_ID in the SALES table is a measure. You need to change CHANNEL_ID column's Treat As property to an attribute in the SALES table.
- Click the SALES table tab.
In the Join dialog, the CHANNEL_ID in the SALES table is treated as a measure. You can convert the CHANNEL_ID column to text to use it in the join with the CHANNELS_VIEW table.
- In the SALES CHANNEL_ID column, select Options, and then click Convert to Text.
- Click the Join Diagram. Click the incomplete join between the SALES and the CHANNELS_VIEW table.
- In the Join dialog, select CHANNEL_ID in the under SALES table. Under CHANNELS_VIEW, select CHANNEL_ID.
You can now save the dataset.
Learn More
Create Joins in Datasets With Multiple Tables
F43667-03
September 2022
Copyright © 2022, Oracle and/or its affiliates.
Learn how to create joins in datasets with multiple tables in Oracle Analytics.
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicable contract for such services. No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.