Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Data Analyst Associate All Questions

View all questions & answers for the Certified Data Analyst Associate exam

Exam Certified Data Analyst Associate topic 1 question 28 discussion

Actual exam question from Databricks's Certified Data Analyst Associate
Question #: 28
Topic #: 1
[All Certified Data Analyst Associate Questions]

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?

  • A. SELECT PRICE customer_spend, customer_units AS customer_price
    FROM customer_summary
  • B. SELECT price -
    FROM customer_summary
  • C. SELECT function(price(customer_spend, customer_units)) AS customer_price
    FROM customer_summary
  • D. SELECT double(price(customer_spend, customer_units)) AS customer_price
    FROM customer_summary
  • E. SELECT price(customer_spend, customer_units) AS customer_price
    FROM customer_summary
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
MrWood47
10 months ago
Selected Answer: E
To apply a user-defined function (UDF) in SQL, you generally call the function by its name and pass the appropriate columns as arguments within a SELECT statement. The result is then aliased to give it a descriptive name, which in this case is customer_price. The UDF price created takes two arguments spend and units and returns their division as a DOUBLE. To apply this function to the customer_spend and customer_units columns of the customer_summary table and create a new column customer_price, you'd simply call the price function with these columns as arguments. Answer E statement selects the result of the price function applied to the customer_spend and customer_units columns and labels the result as customer_price for each row in the customer_summary table.
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

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.

SaveCancel
Loading ...