Complete the code to query the access history for the last 7 days.
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY WHERE EVENT_TIMESTAMP >= CURRENT_DATE() - INTERVAL '[1]' DAY;
The query filters access history for the last 7 days using INTERVAL '7' DAY.
Complete the code to filter audit logs by a specific user.
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY WHERE USER_NAME = '[1]';
Replace '{{BLANK_1}}' with the exact username to filter logs for that user.
Fix the error in the query to get audit logs for a specific object type.
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY WHERE OBJECT_TYPE = '[1]';
Object types in Snowflake audit logs are uppercase, so use 'TABLE'.
Fill both blanks to create a query that counts access events grouped by user and event type.
SELECT USER_NAME, [1], COUNT(*) AS EVENT_COUNT FROM SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY GROUP BY USER_NAME, [2];
Grouping by EVENT_TYPE along with USER_NAME counts events per user per event type.
Fill all three blanks to create a query that filters access history for a specific database, object type, and orders by event time descending.
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY WHERE DATABASE_NAME = '[1]' AND OBJECT_TYPE = '[2]' ORDER BY [3] DESC;
This query filters by database name and object type, then orders results by event timestamp descending.