
Answer-first summary for fast verification
Answer: CREATE TABLE records (id int, year int, month int) PARTITIONED BY (year, month);
To partition a delta table based on one or more columns, the `PARTITIONED BY` keyword should be used. The column or list of columns should be added inside the brackets after the `PARTITIONED BY` keyword. The correct syntax is: `CREATE TABLE records (id int, year int, month int) PARTITIONED BY (year, month);`. Note that `PARTITION BY` and `PARTITIONED BY` may seem similar, but only the latter is used to partition the table.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
Which statement correctly creates a partitioned delta table named records based on the year and month columns?
A
CREATE TABLE records (id int, year int, month int) PARTITIONED BY (year, month);
B
CREATE TABLE records (id int, year int, month int) PARTITION BY (year, month);
C
CREATE TABLE records (id int, year int, month int) PARTITION BY year, month;
D
CREATE TABLE records (id int, year int, month int) PARTITIONED BY year, month;
E
CREATE TABLE records (id int, year int, month int) PARTITION BY (year and month);