Exam Databricks-Certified-Data-Analyst-Associate Topic 1 Question 46 Discussion
Actual exam question for Databricks's Databricks-Certified-Data-Analyst-Associate exam
Question #: 46
Topic #: 1
Question #: 46
Topic #: 1
A data analyst has created a user-defined function using the following line of code:
CREATE FUNCTION price(spend DOUBLE, units DOUBLE)
RETURNS DOUBLE
RETURN spend / units;
Which of the following code blocks can be used to apply this function to the customer_spend and customer_units columns of the table customer_summary to create column customer_price?
CREATE FUNCTION price(spend DOUBLE, units DOUBLE)
RETURNS DOUBLE
RETURN spend / units;
Which of the following code blocks can be used to apply this function to the customer_spend and customer_units columns of the table customer_summary to create column customer_price?
Suggested Answer: E Vote an answer
A user-defined function (UDF) is a function defined by a user, allowing custom logic to be reused in the user environment1. To apply a UDF to a table, the syntax is SELECT udf_name(column_name) AS alias FROM table_name2. Therefore, option E is the correct way to use the UDF price to create a new column customer_price based on the existing columns customer_spend and customer_units from the table customer_summary. Reference:
What are user-defined functions (UDFs)?
User-defined scalar functions - SQL
V
What are user-defined functions (UDFs)?
User-defined scalar functions - SQL
V
by Adonis at Jul 28, 2025, 03:25 AM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).