MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Select the term used to identify all rows after the current row in a partition.
A
FINAL ROW
B
UNBOUNDED FOLLOWING
C
END RANGE
D
CONTINUE TO END
Explanation: 

Detailed explanation-1: -The frame, ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, means that the window consists of the first row of the partition and all the rows up to the current row. Each calculation is done over a different set of rows. For example, when performing the calculation for row 4, the rows 1 to 4 are used.

Detailed explanation-2: -As the first term after the ROWS keyword in a window Frame specification, UNBOUNDED PRECEDING means that the starting boundary is the first row in the partition, and UNBOUNDED FOLLOWING means that the ending boundary is the last row in the partition.

Detailed explanation-3: -UNBOUNDED PRECEDING is the same as BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW . n PRECEDING is the same as BETWEEN n PRECEDING AND CURRENT ROW . n FOLLOWING is the same as BETWEEN CURRENT ROW AND n FOLLOWING . UNBOUNDED FOLLOWING is the same as BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING .

Detailed explanation-4: -ROWS UNBOUNDED PRECEDING is no Teradata-specific syntax, it’s Standard SQL. Together with the ORDER BY it defines the window on which the result is calculated. Logically a Windowed Aggregate Function is newly calculated for each row within the PARTITION based on all ROWS between a starting row and an ending row.

There is 1 question to complete.