I am trying to do the \"insert into table\" and see that we need to explicitly specify the column names. Is there a way to get this data without having to manual type it out
Using INFORMATION_SCHEMA, Elliott's query can be rewritten as:
WITH ColumnNames AS (
SELECT column_name FROM dataset.INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = 'tablename'
)
SELECT CONCAT(
'INSERT dataset.tablename (',
ARRAY_TO_STRING(ARRAY(SELECT column_name FROM ColumnNames), ', '),
')');