Procedural language Flashcards

1
Q

DECLARE

multi

A

DECLARE d DATE DEFAULT CURRENT_DATE();

DECLARE x, y, z INT64 DEFAULT 0;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SET

multi

A

SET variable_name = expression;

SET (a, b, c) = (1 + 3, ‘foo’, false);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

EXECUTE IMMEDIATE

A

EXECUTE IMMEDIATE

“CREATE TEMP TABLE Books (title STRING, publish_date INT64)”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

EXECUTE IMMEDIATE

USING

A

EXECUTE IMMEDIATE
“INSERT INTO Books (title, publish_date) VALUES(?, ?)”
USING 1815 as year, “Emma” as name;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

EXECUTE IMMEDIATE

FORMAT

A

EXECUTE IMMEDIATE FORMAT(“””

SELECT %s FROM books”””, “name”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

BEGIN…EXCEPTION…END

A
BEGIN
  sql_statement_list
EXCEPTION WHEN ERROR THEN
  sql_statement_list
END;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

CASE

A
CASE
  WHEN boolean_expression THEN sql_statement_list
  [...]
  [ELSE sql_statement_list]
END CASE;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

CASE search_expression

A
CASE search_expression
  WHEN expression THEN sql_statement_list
  [...]
  [ELSE sql_statement_list]
END CASE;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

IF

A
IF condition THEN [sql_statement_list]
  [ELSEIF condition THEN sql_statement_list]
  [...]
  [ELSE sql_statement_list]
END IF;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

FOR…IN

A

FOR loop_variable_name IN (table_expression)
DO
sql_expression_list
END FOR;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

CALL

A

CALL procedure_name (procedure_argument[, …])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly