
Answer-first summary for fast verification
Answer: CREATE TABLE unique_user_data AS SELECT DISTINCT * FROM user_data
The correct answer is A because it correctly uses the 'DISTINCT' keyword to select only unique rows from the 'user_data' table and creates a new table 'unique_user_data' with these distinct rows.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are working with a large dataset stored in a Delta Lake table named 'user_data'. The table contains duplicate entries that need to be removed. Write a Spark SQL query to create a new table 'unique_user_data' that contains only the distinct rows from 'user_data'.
A
CREATE TABLE unique_user_data AS SELECT DISTINCT * FROM user_data
B
CREATE TABLE unique_user_data AS SELECT * FROM user_data GROUP BY *
C
CREATE TABLE unique_user_data AS SELECT DISTINCT * FROM user_data WHERE NOT NULL
D
CREATE TABLE unique_user_data AS SELECT * FROM user_data UNION SELECT * FROM user_data