Procedural language Flashcards
1
Q
DECLARE
multi
A
DECLARE d DATE DEFAULT CURRENT_DATE();
DECLARE x, y, z INT64 DEFAULT 0;
2
Q
SET
multi
A
SET variable_name = expression;
SET (a, b, c) = (1 + 3, ‘foo’, false);
3
Q
EXECUTE IMMEDIATE
A
EXECUTE IMMEDIATE
“CREATE TEMP TABLE Books (title STRING, publish_date INT64)”;
4
Q
EXECUTE IMMEDIATE
USING
A
EXECUTE IMMEDIATE
“INSERT INTO Books (title, publish_date) VALUES(?, ?)”
USING 1815 as year, “Emma” as name;
5
Q
EXECUTE IMMEDIATE
FORMAT
A
EXECUTE IMMEDIATE FORMAT(“””
SELECT %s FROM books”””, “name”)
6
Q
BEGIN…EXCEPTION…END
A
BEGIN sql_statement_list EXCEPTION WHEN ERROR THEN sql_statement_list END;
7
Q
CASE
A
CASE WHEN boolean_expression THEN sql_statement_list [...] [ELSE sql_statement_list] END CASE;
8
Q
CASE search_expression
A
CASE search_expression WHEN expression THEN sql_statement_list [...] [ELSE sql_statement_list] END CASE;
9
Q
IF
A
IF condition THEN [sql_statement_list] [ELSEIF condition THEN sql_statement_list] [...] [ELSE sql_statement_list] END IF;
10
Q
FOR…IN
A
FOR loop_variable_name IN (table_expression)
DO
sql_expression_list
END FOR;
11
Q
CALL
A
CALL procedure_name (procedure_argument[, …])
12
Q
EXPORT DATA
A
EXPORT DATA OPTIONS( uri='gs://bucket/folder/*.csv', format='CSV', overwrite=true, header=true, field_delimiter=';') AS SELECT field1, field2 FROM mydataset.table1 ORDER BY field1 LIMIT 10