
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 when creating a table. The syntax is:
COMMENT 'comment text'
COMMENT 'comment text'
For this specific scenario, to indicate that the table contains personally identifiable information (PII), you would add:
COMMENT 'Contains PII'
COMMENT 'Contains PII'
This would be added to the CREATE TABLE statement as follows:
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';
Let's analyze why the other options are incorrect:
A. There is no way to indicate whether a table contains PII. - This is incorrect because Databricks provides multiple ways to document table properties, including comments.
B. "COMMENT PII" - This is incorrect syntax. The COMMENT clause requires the comment text to be in quotes.
C. TBLPROPERTIES PII - While TBLPROPERTIES is a valid clause in Databricks, the syntax would require a key-value pair like TBLPROPERTIES ('pii' = 'true'). The option shown doesn't follow proper syntax.
E. PII - This is not a valid SQL clause for table creation.
Table comments are a standard way to document metadata about tables in Databricks and other SQL databases, making them an appropriate choice for indicating PII content according to organizational policies.