
Ultimate access to all questions.
A data engineer wants to create a new table containing the names of customers that live in France. They have written the following command:
CREATE TABLE customersInFrance
_______ AS
SELECT id,
firstName,
lastName,
FROM customerLocations
WHERE country = 'FRANCE';
CREATE TABLE customersInFrance
_______ AS
SELECT id,
firstName,
lastName,
FROM customerLocations
WHERE country = 'FRANCE';
A senior data engineer mentions that it is organization policy to include a table property indicating that the new table includes personally identifiable information (PII). Which of the following lines of code fills in the above blank to successfully complete the task?
A
There is no way to indicate whether a table contains PII.
B
"COMMENT PII"
C
TBLPROPERTIES PII
D
COMMENT "Contains PII"
E
PII
Explanation:
The correct answer is D: COMMENT "Contains PII". In Databricks SQL, you can add comments to tables using the COMMENT clause in CREATE TABLE statements. The syntax is:
CREATE TABLE table_name
COMMENT 'comment text'
AS SELECT ...
CREATE TABLE table_name
COMMENT 'comment text'
AS SELECT ...
Explanation of options:
TBLPROPERTIES ('key' = 'value'), not just PII.Complete corrected SQL statement:
CREATE TABLE customersInFrance
COMMENT "Contains PII"
AS
SELECT id,
firstName,
lastName,
FROM customerLocations
WHERE country = 'FRANCE';
CREATE TABLE customersInFrance
COMMENT "Contains PII"
AS
SELECT id,
firstName,
lastName,
FROM customerLocations
WHERE country = 'FRANCE';
Alternative approach: You could also use TBLPROPERTIES with proper syntax:
CREATE TABLE customersInFrance
TBLPROPERTIES ('contains_pii' = 'true')
AS SELECT ...
CREATE TABLE customersInFrance
TBLPROPERTIES ('contains_pii' = 'true')
AS SELECT ...
But option D is the correct choice among the given options.