query: CREATE TEMP TABLE temp_user_stats AS SELECT user_id, COUNT(*) as order_count FROM snowflake.db.orders GROUP BY user_id

[User] analyst


query: CREATE TEMP TABLE temp_active_users AS SELECT id, name FROM snowflake.db.users WHERE last_login >= '2021-01-01'

[User] analyst


query: INSERT INTO snowflake.db.user_summary SELECT u.id, u.name, s.order_count FROM temp_active_users u JOIN temp_user_stats s ON u.id = s.user_id

[User] analyst


query: CREATE TEMP TABLE temp_recent_orders AS SELECT * FROM snowflake.db.orders WHERE order_date >= '2021-01-01'

[User] reporter


query: INSERT INTO snowflake.db.audit_log SELECT 'order_processed', user_id, order_date FROM temp_recent_orders

[User] reporter