
Answer-first summary for fast verification
Answer: CREATE TABLE IF NOT EXISTS players( playerId INT, playerName STRING, playerRuns LONG);
The correct command is `CREATE TABLE IF NOT EXISTS`, which ensures the table is only created if it does not already exist. The syntax requires `IF NOT EXISTS` to precede the table name. The default table type in Databricks is DELTA, making the `USING DELTA` clause optional. This approach prevents errors or unintended overwrites of existing tables.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
Which SQL DDL command is used to create an empty Delta table named 'players' with columns playerId (INT), playerName (STRING), and playerRuns (LONG), only if a table with this name does not already exist?
A
CREATE OR REPLACE TABLE players( playerId INT, playerName STRING, playerRuns LONG)USING DELTA;
B
CREATE TABLE IF NOT EXISTS players( playerId INT, playerName STRING, playerRuns LONG);
C
CREATE OR REPLACE TABLE players WITH COLUMNS( playerId INT, playerName STRING, playerRuns LONG)USING DELTA;
D
CREATE TABLE players IF NOT EXISTS( playerId INT, playerName STRING, playerRuns LONG)USING DELTA;
E
CREATE OR REPLACE TABLE players ASSELECT playerId INT, playerName STRING, playerRuns LONGUSING DELTA;
No comments yet.