A data engineer must create an Amazon Athena table cities_usa that contains only US cities from the existing cities_world table. Which SQL statement should be used?
Choose an answer
Tap an option to check your answer.
Correct answer: INSERT INTO cities_usa (city,state) SELECT city, state FROM cities_world WHERE country='usa';.
Why this is the answer
The correct statement uses INSERT INTO ... SELECT FROM which is the standard SQL command for populating a new table with data queried from an existing table. Specifying the columns (city, state) in the INSERT INTO clause is good practice for clarity and to ensure only relevant columns are inserted, even if the SELECT statement also specifies them. The WHERE country='usa' clause correctly filters the data to include only US cities. The second option, MOVE, is not a valid SQL command for transferring data between tables. The third option, INSERT INTO citiesusa SELECT city, state FROM citiesworld WHERE country='usa', is syntactically valid but less precise than specifying the target columns, which is important if the target table has more columns or different column order. The fourth option, UPDATE, is used to modify existing rows in a table, not to insert new ones, making it incorrect for this scenario.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed