DDL Flashcards
1
Q
CREATE
OPTIONS
AS SELECT
A
CREATE TABLE mydataset.top_words
OPTIONS(
description=”Top ten words per Shakespeare corpus”
) AS
SELECT
corpus,
ARRAY_AGG(STRUCT(word, word_count) ORDER BY word_count DESC LIMIT 10) AS top_words
FROM bigquery-public-data.samples.shakespeare
GROUP BY corpus;
2
Q
CREATE FUNCTION
A
CREATE [TEMP] FUNCTION mydataset.multiplyInputs( x FLOAT64, y FLOAT64 ) RETURNS FLOAT64 AS (x * y);
3
Q
CREATE PROCEDURE
A
CREATE PROCEDURE
4
Q
CREATE EXTERNAL TABLE
A
CREATE OR REPLACE EXTERNAL TABLE mydataset.sales
OPTIONS (
format = ‘CSV’,
uris = [‘gs://mybucket/sales.csv’]);