SQL P1 Flashcards

part 1 of studying

1
Q

Window Syntax

A

WDFn() over (partition by [col] order by [col]) as new_col_name

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

WDFn: RANK()

A

same # => same Rank
leaves gaps after repeated ranks
nulls given same rank

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

WDFn: DENSE_RANK()

A

same # => same Rank
no gap after repeated rank

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

WDFn:ROW_NUMBER()

A

just a # to each tow. no repeated ranks

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

PERCENT_RANK()

A

ordered % of data

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

UNION

A

UNION combines the results of two result sets and removes duplicates. UNION ALL doesn’t remove duplicate rows.

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

INTERSECT

A

INTERSECT returns only rows that appear in both result sets.

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

EXCEPT

A

EXCEPT returns only the rows that appear in the first result set but do not appear in the second result set.

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

ROWS BETWEEN lower_bound AND upper_bound

A

just remember it

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

UNBOUNDED PRECEDING

A

All rows before the current row.

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

n PRECEDING

A

n rows before the current row.

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

CURRENT ROW

A

Just the current row.

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

n FOLLOWING

A

n rows after the current row.

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

UNBOUNDED FOLLOWING

A

All rows after the current row.

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