In this section, you'll create a data source to join the data from the the TUTORIAL_CUSTOMER_PROFILE table with the TUTORIAL_CUSTOMER_EVENTS table and populate the extended Events table.
Instructions are provided below for coding manually and by using a data source.
If coding this manually, you'll need the following INSERT statements to join the correct columns from each table:
INSERT INTO "TUTORIAL_CUSTOMER_EXTENDED_EVENTS" ( "entity_id" ,"event" ,"datestamp" ,"age" ,"region" ,"voice_calls_avg" ,"data_usage_avg" ,"sms_usage_avg" ) SELECT "TUTORIAL_CUSTOMER_EVENTS"."entity_id" AS "entity_id" ,"TUTORIAL_CUSTOMER_EVENTS"."event" AS "event" ,"TUTORIAL_CUSTOMER_EVENTS"."datestamp" AS "datestamp" ,"TUTORIAL_CUSTOMER_PROFILE"."age" AS "age" ,"TUTORIAL_CUSTOMER_PROFILE"."region" AS "region" ,"TUTORIAL_CUSTOMER_PROFILE"."voice_calls_avg" AS "voice_calls_avg" ,"TUTORIAL_CUSTOMER_PROFILE"."data_usage_avg" AS "data_usage_avg" ,"TUTORIAL_CUSTOMER_PROFILE"."sms_usage_avg" AS "sms_usage_avg" FROM "TUTORIAL_CUSTOMER_PROFILE" AS "TUTORIAL_CUSTOMER_PROFILE" INNER JOIN "TUTORIAL_CUSTOMER_EVENTS" AS "TUTORIAL_CUSTOMER_EVENTS" ON "TUTORIAL_CUSTOMER_PROFILE"."Entity_Id" = "TUTORIAL_CUSTOMER_EVENTS"."entity_id"
Here, you'll use a data source to accomplish this without coding:
- Select .
- Select .
- In the name field, type TUT_EXTENDED_EVENTS.This data source joins attributes from CUSTOMER_CUSTOMER_PROFILE table to the TUTORIAL_CUSTOMER_EVENTS table.
- On the Sources page, select the following:
Connection The Teradata-Vantage connection you created earlier Database The database in which in which you added the sample data Table TUTORIAL_CUSTOMER_EVENTS and TUTORIAL_CUSTOMER_PROFILE After selecting each table, it moves to the Your selected sources area: - Select Continue.
- On the Joins page, select and drag the connector from the TUTORIAL_CUSTOMER_EVENTS table to the TUTORIAL_CUSTOMER_PROFILE table.
- On the Edit join page:
- Select Inner join.
- Select the TUTORIAL_CUSTOMER_EVENTS field and choose entity_id.
- Select the TUTORIAL_CUSTOEMR_PROFILES field and choose Entity_id.
- Select Save Join.
The Joins page should look similar to this: - Select Continue.
- On the Map and Calculate page, select the following:
Database The database in which you created the Events table Table TUTORIAL_CUSTOMER_EXTENDED_EVENTS - Click Select Table.
- In the Map columns area, map each field from the source table to the destination table, as shown here:
Source table and field field Destination field (in TUTORIAL_CUSTOMER_EXTENDED_EVENTS
table)"TUTORIAL_CUSTOMER_EVENTS"."event" event "TUTORIAL_CUSTOMER_EVENTS"."entity_id" entity_id "TUTORIAL_CUSTOMER_EVENTS"."datestamp" datestamp "TUTORIAL_CUSTOMER_PROFILE"."age" age "TUTORIAL_CUSTOMER_PROFILE"."region" region "TUTORIAL_CUSTOMER_PROFILE"."voice_calls_avg" voice_calls_avg "TUTORIAL_CUSTOMER_PROFILE"."data_usage_avg" data_usage_avg "TUTORIAL_CUSTOMER_PROFILE"."sms_usage_avg" sms_usage_avg Your map should look similar to the following: - Select Save.
- Select data source. to see your newly created