In this example, we use sample data from the val database. We use the accounts, customer, and transactions tables. Since we will create tables during this process, and you might face issues creating tables directly in the val database, let's create our own database, td_analytics_functions_demo.
CREATE DATABASE td_analytics_functions_demo
AS PERMANENT = 110e6;
Note
You must have CREATE TABLE permissions on the database where you want to use In-Database Analytic Functions.
Let's now create the accounts, customer, and transactions tables in our td_analytics_functions_demo database from the corresponding tables in the val database.
Note
If you are using DBeaver, run each CREATE TABLE statement separately or ensure Auto-commit is enabled. Running multiple DDL statements together may result in the following error: Only an ET or null statement is legal after a DDL Statement.
DATABASE td_analytics_functions_demo;
CREATE TABLE customer AS (
SELECT * FROM val.customer
) WITH DATA;
CREATE TABLE accounts AS (
SELECT * FROM val.accounts
) WITH DATA;
CREATE TABLE transactions AS (
SELECT * FROM val.transactions
) WITH DATA;