AWS Certified Data Engineer – Associate (DEA-C01) — Question 139
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?
Answer options
- 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’);
Correct answer: A
Explanation
Option A is correct because it properly uses the INSERT INTO statement to add the selected cities from the cities_world table into the cities_us table based on the specified condition. Option B is incorrect as there is no MOVE command in SQL for this operation. Option C is also valid but does not specify the columns, which is necessary for the INSERT statement. Option D is incorrect since the UPDATE statement is not suitable for populating a new table from another table.