Exam SnowPro Core All QuestionsBrowse all questions from this exam
Question 549

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

    Correct Answer: D

    To find the query ID of the second query executed in the current session, you should use LAST_QUERY_ID(2). Positive numbers in the parameter represent the sequence starting from the first query executed, hence LAST_QUERY_ID(2) correctly retrieves the ID of the second query.

Discussion
bibisaOption: D

Positive numbers start with the first query executed in the session. For example: LAST_QUERY_ID(1) returns the first query. LAST_QUERY_ID(2) returns the second query. LAST_QUERY_ID(6) returns the sixth query. Etc. Negative numbers start with the most recently-executed query in the session. For example: LAST_QUERY_ID(-1) returns the most recently-executed query (equivalent to LAST_QUERY_ID()). LAST_QUERY_ID(-2) returns the second most recently-executed query. Etc.

ShagunMittalOption: D

LAST_QUERY_ID(2) returns the second query LAST_QUERY_ID(-2) returns the second most recently-executed query

BobFarOption: D

Positive numbers start with the first query executed in the session. For example: LAST_QUERY_ID(1) returns the first query. LAST_QUERY_ID(2) returns the second query. LAST_QUERY_ID(6) returns the sixth query. Negative numbers start with the most recently-executed query in the session. For example: LAST_QUERY_ID(-1) returns the most recently-executed query (equivalent to LAST_QUERY_ID()). LAST_QUERY_ID(-2) returns the second most recently-executed query. https://docs.snowflake.com/en/sql-reference/functions/last_query_id#usage-notes

BobFarOption: D

Correct Answer is D. LAST_QUERY_ID(2) returns the second query LAST_QUERY_ID(-2) returns the second most recently-executed query

MultiCloudIronManOption: D

correct

Katarzyna04Option: A

Should be A, tested in Snowflake.

Simbajagnole

Incorrect, its D