CERTIFIED-DATA-ANALYST-ASSOCIATE · Question #4
A data analyst runs the following command: INSERT INTO stakeholders.suppliers TABLE stakeholders.new_suppliers; What is the result of running this command?
The correct answer is C. The suppliers table now contains both the data it had before the command was run and the data. Option C is correct because INSERT INTO ... TABLE ... is valid BigQuery SQL syntax that appends all rows from new_suppliers into suppliers - the original rows in suppliers are preserved, and the new rows are added alongside them. Why the distractors are wrong: A - though…
Question
A data analyst runs the following command:
INSERT INTO stakeholders.suppliers TABLE stakeholders.new_suppliers; What is the result of running this command?
Options
- AThe suppliers table now contains both the data it had before the command was run and the data
- BThe command fails because it is written incorrectly.
- CThe suppliers table now contains both the data it had before the command was run and the data
- DThe suppliers table now contains the data from the new suppliers table, and the new suppliers
- EThe suppliers table now contains only the data from the new suppliers table.
How the community answered
(21 responses)- A10% (2)
- C71% (15)
- D5% (1)
- E14% (3)
Explanation
Option C is correct because INSERT INTO ... TABLE ... is valid BigQuery SQL syntax that appends all rows from new_suppliers into suppliers - the original rows in suppliers are preserved, and the new rows are added alongside them.
Why the distractors are wrong:
- A - though truncated in the question, A likely contains an inaccuracy about what happens to one of the tables (possibly claiming new_suppliers is deleted or altered), which INSERT INTO does not do.
- B - the command is syntactically valid in BigQuery;
TABLE source_tableis an accepted shorthand forSELECT * FROM source_tablein an INSERT statement. - D - INSERT INTO does not affect the source table (
new_suppliers) in any way; it remains unchanged after the operation. - E - INSERT INTO never truncates the destination table; it only adds rows. A
TRUNCATEorCREATE OR REPLACE TABLEwould be needed to replace existing data.
Memory tip: Think of INSERT INTO as a funnel - data only flows in, nothing gets removed. If you want to replace data, you need an explicit DELETE/TRUNCATE first. The TABLE keyword in BigQuery is simply shorthand for SELECT * FROM, so INSERT INTO a TABLE b = INSERT INTO a SELECT * FROM b.
Community Discussion
No community discussion yet for this question.