Questions and Answers
Question NeWt0UFwUNmVZuSfv1NT
Question
A data engineer needs to apply custom logic to string column city in table stores for a specific use case. In order to apply this custom logic at scale, the data engineer wants to create a SQL user-defined function (UDF). Which of the following code blocks creates this SQL UDF?
Choices
- A:
- B:
- C:
- D:
- E:
answer?
Answer: A Answer_ET: A Community answer A (100%) Discussion
Comment 856949 by Flexron
- Upvotes: 14
E is wrong, the right answer is A. https://www.databricks.com/blog/2021/10/20/introducing-sql-user-defined-functions.html
Comment 858060 by XiltroX
- Upvotes: 8
Selected Answer: A The answer E is incorrect. A user defined function is never written as CREATE UDF. The correct way is CREATE FUNCTION. So that leaves us with the choices A and D. Out of that, in D, there is no such thing as RETURN CASE so the correct answer is A.
Comment 1278795 by Ani_Ni
- Upvotes: 1
A and D
Comment 1244541 by 3fbc31b
- Upvotes: 1
Selected Answer: A A is the correct syntax for creating a UDF in Databricks.
Comment 1203175 by benni_ale
- Upvotes: 1
Selected Answer: A A is correct
Comment 1174941 by a_51
- Upvotes: 1
Selected Answer: A https://docs.databricks.com/en/udf/index.html#language-sql
Answer E is not correct when having CREATE UDF rather than CREATE FUNCTION
Comment 1146571 by isamrat28
- Upvotes: 1
Correct Answer is A
Comment 1137306 by agAshish
- Upvotes: 3
D, should be the answer. The fucntion is not returning STRING , it is applied on a string column
Comment 1113198 by SerGrey
- Upvotes: 1
Selected Answer: A Correct answer is A
Comment 1071094 by Huroye
- Upvotes: 3
Correct answer is A. It is not E. First, you do not need to specify “UDF” in the syntax. You need to specify the return type and then what you want to return, usually your processed output. CREATE FUNCTION myUDF(udf STRING) RETURNS STRING <…udf…>
Comment 1044721 by VijayKula
- Upvotes: 1
Selected Answer: A Create Function Return String
Comment 1028815 by VijayKula
- Upvotes: 1
Selected Answer: A Correct is A
Comment 1028520 by DavidRou
- Upvotes: 2
A is the right answer. The template to use is the following: CREATE FUNCTION <name_function> (<function_parameter>, ..) RETURNS <return_type>
Comment 1019629 by AtanuChat
- Upvotes: 1
First need create a function and then need to register it as UDF
Comment 1017355 by KalavathiP
- Upvotes: 1
Selected Answer: A A is correct
Comment 1016565 by d_b47
- Upvotes: 1
Selected Answer: A no UDF only FUNCTION needed.
Comment 956081 by akk_1289
- Upvotes: 1
CORRECT ANSWER IS : A https://www.databricks.com/blog/2021/10/20/introducing-sql-user-defined-functions.html
Comment 946002 by Atnafu
- Upvotes: 1
A — Create the UDF CREATE FUNCTION custom_logic(city STRING) RETURNS STRING BEGIN — Custom logic goes here — Example: Return the uppercase version of the city RETURN UPPER(city); END;
Comment 881653 by malani
- Upvotes: 1
D also works
Comment 876214 by Varma_Saraswathula
- Upvotes: 1
Ans - A https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-create-sql-function.html
Comment 875877 by naxacod574
- Upvotes: 1
Option A
Comment 860639 by sdas1
- Upvotes: 1
option A
Comment 860437 by knivesz
- Upvotes: 1
Selected Answer: A A es la correcta
Comment 859670 by surrabhi_4
- Upvotes: 2
Selected Answer: A option A
Comment 859070 by rafahb
- Upvotes: 1
A is correct
Question ScPl49LwyQHpkOWBXrYz
Question
Which of the following commands will return the number of null values in the member_id column?
Choices
- A: SELECT count(member_id) FROM my_table;
- B: SELECT count(member_id) - count_null(member_id) FROM my_table;
- C: SELECT count_if(member_id IS NULL) FROM my_table;
- D: SELECT null(member_id) FROM my_table;
answer?
Answer: C Answer_ET: C Community answer C (100%) Discussion
Comment 1366383 by Kayceetalks
- Upvotes: 1
Selected Answer: C correct option
Question UvGX3xpKGBOL2dlCrOmb
Question
Which tool is used by Auto Loader to process data incrementally?
Choices
- A: Checkpointing
- B: Spark Structured Streaming
- C: Databricks SQL
- D: Unity Catalog
answer?
Answer: B Answer_ET: B Community answer B (100%) Discussion
Comment 1366384 by Kayceetalks
- Upvotes: 1
Selected Answer: B Correct
Question X8YYGM8Cvwd6e4RjL1MA
Question
A data engineer is working with two tables. Each of these tables is displayed below in its entirety.
//IMG//
The data engineer runs the following query to join these tables together:
//IMG//
Which of the following will be returned by the above query?
Choices
- A:
- B:
- C:
- D:
answer?
Answer: C Answer_ET: C Community answer C (100%) Discussion
Comment 1387435 by analyticstraining
- Upvotes: 2
Selected Answer: C It’s the same question as 68 and 112.
Question uuK3COn08EIShoSyoZi1
Question
A data analyst has a series of queries in a SQL program. The data analyst wants this program to run every day. They only want the final query in the program to run on Sundays. They ask for help from the data engineering team to complete this task. Which of the following approaches could be used by the data engineering team to complete this task?
Choices
- A: They could submit a feature request with Databricks to add this functionality.
- B: They could wrap the queries using PySpark and use Python’s control flow system to determine when to run the final query.
- C: They could only run the entire program on Sundays.
- D: They could automatically restrict access to the source table in the final query so that it is only accessible on Sundays.
- E: They could redesign the data model to separate the data used in the final query into a new table.
answer?
Answer: B Answer_ET: B Community answer B (100%) Discussion
Comment 946004 by Atnafu
- Upvotes: 11
B
The answer is B.
Option A: Submitting a feature request with Databricks to add this functionality is not a feasible solution because it would require Databricks to implement new functionality.
Option C: Only running the entire program on Sundays would be inconvenient for the data analyst because they would have to remember to run the program on Sundays.
Option D: Automatically restricting access to the source table in the final query so that it is only accessible on Sundays would be difficult to implement and would not be a reliable solution.
Option E: Redesigning the data model to separate the data used in the final query into a new table would be a major undertaking and would not be a feasible solution for this specific problem.
Therefore, the only feasible solution to the problem is to wrap the queries using PySpark and use Python’s control flow system to determine when to run the final query. python code
Comment 1314113 by 806e7d2
- Upvotes: 2
Selected Answer: B Wrapping the SQL program in PySpark allows the data engineering team to leverage Python’s control flow (e.g., if statements) to determine when the final query should execute. For example:
The PySpark program can check the current day using Python’s datetime module. If the current day is Sunday, it will execute all queries, including the final one. If it’s not Sunday, the program will skip the final query. This approach ensures flexibility and allows precise control over which queries run on which days, meeting the data analyst’s requirements.
Comment 1262406 by 80370eb
- Upvotes: 1
Selected Answer: B B. They could wrap the queries using PySpark and use Python’s control flow system to determine when to run the final query.
This approach involves using PySpark to control the execution flow based on the day of the week, allowing the final query to execute conditionally while the other queries run daily.
Comment 1113200 by SerGrey
- Upvotes: 1
Selected Answer: B Correct answer is B
Comment 1028817 by VijayKula
- Upvotes: 1
Selected Answer: B B is correct
Comment 1017356 by KalavathiP
- Upvotes: 1
Selected Answer: B B is correct ans
Comment 1016566 by d_b47
- Upvotes: 1
Selected Answer: B B is correct.
Comment 945732 by mehroosali
- Upvotes: 1
Selected Answer: B B is correct
Comment 916688 by [Removed]
- Upvotes: 1
Selected Answer: B B is correct
Comment 862189 by XiltroX
- Upvotes: 1
Selected Answer: B B is the correct answer
Comment 860859 by mimzzz
- Upvotes: 1
i think the answer is correct
Comment 860468 by knivesz
- Upvotes: 1
Selected Answer: B Respuesta Correcta es B