SnowPro Associate: Platform Question 267
Single answer● View the table definitionA data engineer needs to confirm the exact column definitions, data types, and nullability of the SALES.PUBLIC.ORDERS table before loading a new batch of files. She wants a quick SQL command that returns the table's column metadata directly in Snowflake. Which command should she use?
- A
DESCRIBE TABLE SALES.PUBLIC.ORDERS;
- B
SHOW TABLES LIKE 'ORDERS' IN SCHEMA SALES.PUBLIC;
- C
GET_DDL('TABLE', 'SALES.PUBLIC.ORDERS');
- D
SHOW COLUMNS IN DATABASE SALES;
Show answer and explanation
Correct answer: A
Explanation
To view a specific table definition in Snowflake, DESCRIBE TABLE (or its synonym DESC TABLE) is the standard and most direct command. It is commonly used by engineers and administrators to inspect column names, data types, nullability, defaults, and related metadata before data loads or schema changes. SHOW commands are intended more for listing objects or broader metadata inventories, while GET_DDL is useful when you need the recreate statement for migration, version control, or auditing. Snowflake documentation distinguishes these metadata tools by purpose: DESCRIBE for object structure, SHOW for object listings, and GET_DDL for retrieving creation statements.
- A. Correct.
Correct. DESCRIBE TABLE returns the table definition details for the specified table, including column names, data types, kind, nullability, default values, and related metadata. This is the most direct command for quickly viewing a table's structure in SQL.
- B. Incorrect.
Incorrect. SHOW TABLES lists table objects and high-level properties such as database, schema, and creation time, but it does not return the detailed column-level definition needed to validate data types and nullability.
- C. Incorrect.
Incorrect. GET_DDL can return the DDL statement used to recreate the table, which may include column definitions, but it is a function rather than the quickest direct metadata command for inspecting the table definition in tabular form. It is useful for scripting and object recreation, but less suited when the goal is simply to view column metadata interactively.
- D. Incorrect.
Incorrect. SHOW COLUMNS IN DATABASE SALES returns columns for objects across the database scope rather than focusing on a single table definition. While it may include the ORDERS table's columns among many others, it is not the best command for directly viewing one table's definition.