You are working with clickstream data in Snowflake, stored in a table named This table has the following columns: (INTEGER), 'user_id' (INTEGER), (TIMESTAMP NTZ), 'event_type' (VARCHAR, e.g., 'page_view', 'button_click'), and 'session_id' (VARCHAR). A session is defined as a series of events by a single user with no more than 30 minutes between consecutive events. You need to determine the duration of each session in seconds. Which of the following SQL queries, when executed in Snowflake, will correctly calculate the duration of each session?

Correct Answer: B,E
Options B and E are correct. Option B directly calculates the duration using 'DATEDIFF between the minimum and maximum timestamp within each session, grouped by Option E first calculates the previous event timestamp for each event within a session and calculates 'session_start' and 'session_end' correctly. Option A will result in errors since arithmetic operators are not allowed on TIMESTAMP_NTZ values. Option C does not aggregate the data by before subtracting start/end values. Option D is overly complex and also uses LAST VALUE which could result in errors since arithmetic operators are not allowed on TIMESTAMP NTZ values.