
Ultimate access to all questions.
A data engineer has been given a new record of data:
id STRING = 'a1'
rank INTEGER = 6
rating FLOAT = 9.4
id STRING = 'a1'
rank INTEGER = 6
rating FLOAT = 9.4
Which SQL commands can be used to append the new record to an existing Delta table my_table?
A
INSERT INTO my_table VALUES ('a1', 6, 9.4)
B
INSERT VALUES ('a1', 6, 9.4) INTO my_table
C
UPDATE my_table VALUES ('a1', 6, 9.4)
D
UPDATE VALUES ('a1', 6, 9.4) my_table
Explanation:
Option A is correct because it follows the standard SQL syntax for inserting data into a table:
INSERT INTO table_name VALUES (value1, value2, value3, ...)
INSERT INTO table_name VALUES (value1, value2, value3, ...)
Option B is incorrect because the syntax INSERT VALUES ... INTO table_name is not valid SQL syntax. The correct order is INSERT INTO table_name VALUES (...).
Option C is incorrect because UPDATE is used to modify existing records, not to insert new records. The UPDATE statement requires a SET clause and typically a WHERE clause, not a VALUES clause.
Option D is incorrect for the same reason as option C - UPDATE is for modifying existing data, not inserting new records, and the syntax is completely invalid.
For Delta tables specifically, the standard SQL INSERT syntax works perfectly, and Databricks SQL supports this syntax for appending data to Delta tables.