
Answer-first summary for fast verification
Answer: CREATE TABLE employees USING JDBC OPTIONS (url 'jdbc:mysql://localhost:3306/mydb', dbtable 'employees', user 'root', password 'password')
The correct answer is A because it correctly specifies the JDBC options including the URL, database table name, user, and password. The columns are automatically inferred from the table schema in the database.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are given a task to create a table named 'employees' from a JDBC connection to a MySQL database. The table should include columns 'id', 'name', and 'salary'. Write the Spark SQL command to achieve this.
A
CREATE TABLE employees USING JDBC OPTIONS (url 'jdbc:mysql://localhost:3306/mydb', dbtable 'employees', user 'root', password 'password')
B
CREATE TABLE employees USING JDBC OPTIONS (url 'jdbc:mysql://localhost:3306/mydb', dbtable 'employees', user 'root', password 'password', columns 'id', 'name', 'salary')
C
CREATE TABLE employees USING JDBC OPTIONS (url 'jdbc:mysql://localhost:3306/mydb', dbtable 'employees', user 'root', password 'password', columns 'id, name, salary')
D
CREATE TABLE employees USING JDBC OPTIONS (url 'jdbc:mysql://localhost:3306/mydb', dbtable 'employees', user 'root', password 'password', columns 'id name salary')
No comments yet.