ExamGecko
Question list
Search
Search

Question 519 - SnowPro Core discussion

Report
Export

Which function should be used to find the query ID of the second query executed in a current session?

A.

Select LAST_QUERY_ID(-2)

Answers
A.

Select LAST_QUERY_ID(-2)

B.

Select LAST_QUERY_ID(2)

Answers
B.

Select LAST_QUERY_ID(2)

C.

Select LAST_QUERY_ID(1)

Answers
C.

Select LAST_QUERY_ID(1)

D.

Select LAST_QUERY_ID(2)

Answers
D.

Select LAST_QUERY_ID(2)

Suggested answer: A

Explanation:

The correct function to find the query ID of the second query executed in the current session is SELECT LAST_QUERY_ID(-2). The LAST_QUERY_ID function returns the query ID for the most recent query executed in the session when called with no arguments. When used with an argument, it can retrieve the ID of previous queries within the same session, where -2 would reference the second most recent query executed.

There's a clarification needed here; Snowflake's documentation indicates LAST_QUERY_ID() function does not accept arguments. It returns the ID of the last query executed in the session. To find the query ID of the second last executed query, users typically need to track query IDs manually or use session history views.

asked 29/10/2024
Jeremy Cheeseborough
41 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first