Test 2 - Calculations Flashcards

1
Q

What is the DATEDIFF syntax?

A

DATEDIFF(‘date_part’, date1, date2)

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

What does the DATE function do?

A

Changes string and number expressions into dates, as long as they are in a recognizable format

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

What function should you use if DATE does not recognize the input?

A

DATEPARSE

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

What does DATENAME do?

A

Returns the requested date part of a given date as a string

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

What is the DATENAME syntax?

A

DATENAME(‘date_part’, date)

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

What does DATEPARSE do?

A

returns specifically formatted strings as dates

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

What is the DATEPARSE syntax?

A

DATEPARSE(‘date_format’, “date_string”)

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

What does DATEPART do?

A

returns the name of the specified date part as an integer

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

What is the syntax for DATEPART?

A

DATEPART(‘date_part’, date)

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

What does MAKEDATE do?

A

returns a date value constructed from the specified year, month, and day

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

What is the syntax for MAKEDATE?

A

MAKEDATE(year, month, day)

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

What is the syntax for CONTAINS

A

CONTAINS(“string”, “substring”)

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

What is the syntax for LEFT?

A

LEFT(“string”, “number of characters”)

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

What are three functions used to change casing?

A

LOWER, UPPER, PROPER

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

What do LTRIM, RTRIM, and TRIM do?

A

Remove spacing from the respective sides

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

What does the ZN function do?

A

Returns value if given expression isn’t null, or 0 if it is null

17
Q

What is the syntax for a type conversion function?

A

TYPE(expression)

18
Q

What is the syntax for REPLACE?

A

REPLACE(string, substring, replacement)

19
Q

What is the syntax for SPLIT?

A

SPLIT(string, delimiter, token number)

20
Q

What is the result of SPLIT (“a-b-c-d”, “-“, 2)?

A

b

21
Q

What is the result of SPLIT (“a|b|c|d”, “|”, -2)?

A

c

22
Q

What is CASE statement syntax?

A

CASE <expression>
WHEN <'value1'> THEN <'then1'>
WHEN <'value2'> THEN <'then2'>
...
[ELSE <'default'>]
END</expression>

23
Q

What does IF NULL do?

A

Given syntax IFNULL(expr1, expr2), returns expr1 if non-null, otherwise returns expr2

24
Q

What do FIXED LOD calculations do?

A

compute a value using the specified dimensions, without reference to the dimensions in the view

25
Q

What are the Quick Table calculations available?

A
  1. Running total
  2. Difference
  3. Percent difference
  4. Percent of total
  5. Rank
  6. Percentile
  7. Moving average
  8. YTD total
  9. Compound growth rate
  10. Year of year growth
  11. YTD growth
26
Q

Which table calculation returns the number of rows from the current row to the first row in the partition?

A

FIRST()

27
Q

Which table calculation returns the index of the current row in the partition, without any sorting with regard to value?

A

INDEX()

28
Q

Which table calculation returns the value of the expression in a target row, specified as a relative offset from the current row?

A

LOOKUP()

29
Q

Which table calculation might return the following rankings : 1,1,1,4,4,6,7,7,7,10?

A

RANK()

30
Q

Which table calculation might return the following rankings : 1,1,1,2,2,3,4,4,4,5?

A

RANK_DENSE()

31
Q

Which table calculation might return the following rankings : 3,3,3,5,5,6,9,9,9,10?

A

RANK_MODIFIED()

32
Q

Which table calculation might return the following rankings : 1,2,3,4,5,6,7,8,9,10?

A

RANK_UNIQUE()

33
Q

Which table calculation returns rankings as percentiles?

A

RANK_PERCENTILE()