Window Function Descriptions • LEAD( expr  [,  N [,  default ]])  [ null_treatment ]  over_clause •an unsigned integer constant literal •a positional parameter marker ( ? ) •a user-defined variable •a local variable in a stored routine • NTH_VALUE( expr ,  N )  [ from_first_last ] [ null_treatment ]  over_clause • NTILE( N ) over_clause •an unsigned integer constant literal Returns the value of  expr  from the row that leads (follows) the current row by  N  rows within its partition. If there is no such row, the return value is  default . For example, if  N  is 3, the return value is  default for the last two rows. If  N  or  default  are missing, the defaults are 1 and  NULL , respectively. N  must be a literal nonnegative integer. If  N  is 0,  expr  is evaluated for the current row. Beginning with MySQL 8.0.22,  N  cannot be  NULL . In addition, it must now be an integer in the range  1  to 2 $^{63}$, inclusive, in any of the following forms: over_clause  is as described in Section 12.21.2, “Window Function Concepts and Syntax” . null_treatment  is as described in the section introduction. For an example, see the  LAG()  function description. In MySQL 8.0.22 and later, use of a negative value for the rows argument of this function is not permitted. Returns the value of  expr  from the  N -th row of the window frame. If there is no such row, the return value is  NULL . N  must be a literal positive integer. from_first_last  is part of the SQL standard, but the MySQL implementation permits only  FROM FIRST  (which is also the default). This means that calculations begin at the first row of the window.  FROM LAST  is parsed, but produces an error. To obtain the same effect as  FROM LAST  (begin calculations at the last row of the window), use  ORDER BY  to sort in reverse order. over_clause  is as described in Section 12.21.2, “Window Function Concepts and Syntax” . null_treatment  is as described in the section introduction. For an example, see the  FIRST_VALUE()  function description. In MySQL 8.0.22 and later, you cannot use  NULL  for the row argument of this function. Divides a partition into  N  groups (buckets), assigns each row in the partition its bucket number, and returns the bucket number of the current row within its partition. For example, if  N  is 4,  NTILE()  divides rows into four buckets. If  N  is 100,  NTILE()  divides rows into 100 buckets. N  must be a literal positive integer. Bucket number return values range from 1 to  N . Beginning with MySQL 8.0.22,  N  cannot be  NULL . In addition, it must be an integer in the range  1  to  2 $^{63}$, inclusive, in any of the following forms: 2422