How could I conveniently get the creating-SQL of a table in BigQuery? We could use INFORMATION_SCHEMA
:
SELECT table_name, ddl FROM `data-to-insights.taxi.INFORMATION_SCHEMA.TABLES` WHERE table_name="tlc_yellow_trips_2018_sample"
The result of ddl
is:
CREATE TABLE `data-to-insights.taxi.tlc_yellow_trips_2018_sample` ( vendor_id STRING, pickup_datetime DATETIME, dropoff_datetime DATETIME, passenger_count INT64, trip_distance NUMERIC, rate_code STRING, store_and_fwd_flag STRING, payment_type STRING, fare_amount NUMERIC, extra NUMERIC, mta_tax NUMERIC, tip_amount NUMERIC, tolls_amount NUMERIC, imp_surcharge NUMERIC, total_amount NUMERIC, pickup_location_id STRING, dropoff_location_id STRING );