You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*ERROR 1370 (42000) at line 5: execute command denied to user '@'localhost' for routine 'DATEPART'.
Can you please let me know how to resolve this? I had this question in an internal exam and couldn't solve so I checked out yours and it shows the above error.
The text was updated successfully, but these errors were encountered:
try to identify suspicious transactions based on the defined criteria.
WITH ranked_transactions AS (
SELECT
sender,
dt,
amount,
UNIX_TIMESTAMP(dt) AS ts,
LAG(UNIX_TIMESTAMP(dt)) OVER (PARTITION BY sender ORDER BY dt) AS prev_ts,
LAG(amount) OVER (PARTITION BY sender ORDER BY dt) AS prev_amount
FROM
transactions
),
sequences AS (
SELECT
sender,
dt,
amount,
ts,
CASE
WHEN ts - prev_ts <= 3600 OR prev_ts IS NULL THEN 0
ELSE 1
END AS is_start
FROM
ranked_transactions
),
cumulative_amounts AS (
SELECT
sender,
dt,
amount,
ts,
SUM(is_start) OVER (PARTITION BY sender ORDER BY dt) AS seq_id
FROM
sequences
),
suspicious_sequences AS (
SELECT
sender,
MIN(dt) AS sequence_start,
MAX(dt) AS sequence_end,
COUNT() AS transactions_count,
ROUND(SUM(amount), 6) AS transactions_sum
FROM
cumulative_amounts
GROUP BY
sender,
seq_id
HAVING
COUNT() >= 2
AND SUM(amount) >= 150
)
SELECT
sender,
sequence_start,
sequence_end,
transactions_count,
transactions_sum
FROM
suspicious_sequences
ORDER BY
sender,
sequence_start;
[01_crypto_market_algorithm.md]
*ERROR 1370 (42000) at line 5: execute command denied to user '@'localhost' for routine 'DATEPART'.
Can you please let me know how to resolve this?
I had this question in an internal exam and couldn't solve so I checked out yours and it shows the above error.
The text was updated successfully, but these errors were encountered: