nerdexam
Snowflake

SOL-C01 · Question #61

A user executes the following SQL command in Snowflake: `SELECT CURRENT DATABASE(), CURRENT SCHEMA(), CURRENT ROLE(), CURRENT The user's current role is , and they are connected to the 'REPORTING WH'

The correct answer is A. DATA MART, PUBLIC, ANALYST, REPORTING WH. Option A is correct because Snowflake automatically applies user-level default settings to a new session at connection time - no explicit USE DATABASE or USE SCHEMA command is needed. Since the user's defaults were configured as DATA_MART (database) and PUBLIC (schema), those val

Querying and Performance

Question

A user executes the following SQL command in Snowflake: `SELECT CURRENT DATABASE(), CURRENT SCHEMA(), CURRENT ROLE(), CURRENT The user's current role is , and they are connected to the 'REPORTING WH' warehouse. Before executing this command, the default schema for the user was set to 'PUBLIC' within the 'DATA MART database. What will be the result of this query?

Options

  • ADATA MART, PUBLIC, ANALYST, REPORTING WH
  • BNULL, NULL, ANALYST, REPORTING WH
  • CCurrent database, Current schema, ANALYST, REPORTING WH
  • DEmpty string, Empty string, ANALYST, REPORTING_WH
  • EAn error will occur because no database or schema context is explicitly set in the session.

How the community answered

(27 responses)
  • A
    78% (21)
  • B
    11% (3)
  • C
    4% (1)
  • D
    4% (1)
  • E
    4% (1)

Explanation

Option A is correct because Snowflake automatically applies user-level default settings to a new session at connection time - no explicit USE DATABASE or USE SCHEMA command is needed. Since the user's defaults were configured as DATA_MART (database) and PUBLIC (schema), those values are active in the session and returned by CURRENT_DATABASE() and CURRENT_SCHEMA() respectively, while CURRENT_ROLE() and CURRENT_WAREHOUSE() reflect the stated session context.

Why the distractors fail:

  • B (NULL, NULL) is wrong because NULLs are only returned when no default is configured at all - user defaults populate the session automatically.
  • C is a non-answer; "Current database/schema" just restates the function names rather than providing actual values.
  • D is doubly wrong: Snowflake returns NULL (not empty string) when context is missing, and the warehouse name REPORTING_WH uses an underscore whereas the actual warehouse is REPORTING WH (with a space).
  • E is wrong because CURRENT_DATABASE() and friends never throw errors - they simply return NULL if no context exists.

Memory tip: Think of Snowflake user defaults as "auto-login settings" - just like a browser remembers your last tab, Snowflake loads your configured defaults the moment you connect, without any extra commands.

Topics

#Session context#Context functions#CURRENT_DATABASE()#CURRENT_SCHEMA()

Community Discussion

No community discussion yet for this question.

Full SOL-C01 Practice