1 个回答
具体实现如下:
-- 创建维度表(如用户信息表)
CREATE TABLE dim_users (
user_id STRING,
user_name STRING,
city STRING,
PRIMARY KEY (user_id) NOT ENFORCED
) WITH (
'connector' = 'jdbc',
'url' = 'jdbc:mysql://localhost:3306/mydb',
'table-name' = 'users',
'username' = 'root',
'password' = '123456'
);
流数据与维度表关联-- 流数据(订单表)与维度表(用户表)关联
SELECT
o.order_id,
o.amount,
u.user_name,
u.city
FROM stream_orders o
JOIN dim_users u ON o.user_id = u.user_id;
发布于:3周前 (05-28) IP属地:
我来回答
您需要 登录 后回答此问题!