The MODEL or SPREADSHEET clause is very much like treating the result set of a query as a multidimensional array.
The keywords MODEL and SPREADSHEET are synonymous.
The MODEL or SPREADSHEET clause allows us to compute a row in the result set that can retrieve data on some other row(s) without explicitly defining a virtual table.
The overall syntax for the MODEL or SPREADSHEET SQL statement
MODEL [main]
[reference models]
[PARTITION BY ()]
DIMENSION BY ()
MEASURES ()
[IGNORE NAV] | [KEEP NAV]
[RULES
[UPSERT | UPDATE]
[AUTOMATIC ORDER | SEQUENTIAL ORDER]
[ITERATE (n) [UNTIL ] ]
( = ... )