0
0
Snowflakecloud~10 mins

Views and materialized views in Snowflake - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a simple view named employee_view that selects all columns from the employees table.

Snowflake
CREATE VIEW employee_view AS SELECT * FROM [1];
Drag options to blanks, or click blank then click option'
Adepartments
Bemployees
Csalaries
Dlocations
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a table unrelated to employees like departments or locations.
Forgetting to use the correct table name.
2fill in blank
medium

Complete the code to create a materialized view named sales_summary that sums the amount column from the sales table.

Snowflake
CREATE MATERIALIZED VIEW sales_summary AS SELECT SUM([1]) AS total_amount FROM sales;
Drag options to blanks, or click blank then click option'
Aamount
Bquantity
Cprice
Ddiscount
Attempts:
3 left
💡 Hint
Common Mistakes
Summing the wrong column like quantity or discount.
Using a column that does not exist in the sales table.
3fill in blank
hard

Fix the error in the code to create a view named dept_view that selects department_id and department_name from the departments table.

Snowflake
CREATE VIEW dept_view AS SELECT department_id, [1] FROM departments;
Drag options to blanks, or click blank then click option'
Adepartment_name
Bdepartment
Cdept_name
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using abbreviated or incorrect column names like dept_name or name.
Using a column that does not exist.
4fill in blank
hard

Fill both blanks to create a materialized view named active_customers that selects customer_id and customer_name from customers where status is 'active'.

Snowflake
CREATE MATERIALIZED VIEW active_customers AS SELECT [1], [2] FROM customers WHERE status = 'active';
Drag options to blanks, or click blank then click option'
Acustomer_id
Bcustomer_name
Cstatus
Dcustomer_status
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting the status column instead of customer_name.
Using incorrect column names like customer_status.
5fill in blank
hard

Fill all three blanks to create a view named order_details_view that selects order_id, product_id, and quantity from the order_details table where quantity is greater than 10.

Snowflake
CREATE VIEW order_details_view AS SELECT [1], [2], [3] FROM order_details WHERE quantity > 10;
Drag options to blanks, or click blank then click option'
Aorder_id
Bproduct_id
Cquantity
Dprice
Attempts:
3 left
💡 Hint
Common Mistakes
Including columns not requested like price.
Missing one of the required columns.