
Answer-first summary for fast verification
Answer: INSERT INTO cities_usa (city, state) SELECT city, state FROM cities_world WHERE country='usa';
Option A is CORRECT because the INSERT INTO statement explicitly lists the columns (city, state) for the cities_usa table. This ensures the query works correctly even if the cities_usa table contains additional columns that are not included in the insert operation. By filtering the data from cities_world where the country is 'usa', this query meets the requirement to create a subset of the data.
Author: Ritesh Yadav
Ultimate access to all questions.
Question 53/60
A data engineer needs to create an Amazon Athena table based on a subset of data from an existing Athena table named cities_world. The cities_world table contains cities that are located around the world. The data engineer must create a new table named cities_us to contain only the cities from cities_world that are located in the US.
Which SQL statement should the data engineer use to meet this requirement?
A
INSERT INTO cities_usa (city, state) SELECT city, state FROM cities_world WHERE country='usa';
B
MOVE city, state FROM cities_world TO cities_usa WHERE country='usa';
C
INSERT INTO cities_usa SELECT city, state FROM cities_world WHERE country='usa';
D
UPDATE cities_usa SET (city, state) = (SELECT city, state FROM cities_world WHERE country='usa');
No comments yet.