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
-- Functionality: This SQL query calculates the correlation coefficient between the 'Change_Percent' values of 'QQQ' and 'SPY' stocks over recent periods.
SELECT CORR(SPY_Change, QQQ_Change) AS Correlation_Coefficient
FROM (
SELECTp.Interval_Date_Time,
SUM(CASE WHEN p.Symbol='SPY' THEN p.Change_Percent ELSE 0 END) AS SPY_Change,
SUM(CASE WHEN p.Symbol='QQQ' THEN p.Change_Percent ELSE 0 END) AS QQQ_Change