row_number() over() 中参数不同导致结果不同
1.这个函数里order by 这个参数是必须的吗?(我没写参数,没报错呢)
2.假如有个table,在db里的数据是这样
col1 col2
1a 1
2a 2
执行以下sql
select col1,col2,row_number() over() from table
这样不写参数,按什么排序不能确定,不同时间或者机器执行的结果会不会不同?还是参数默认按照order by col1,col2 asc 来排序,结果不会因为其他条件不同而变更。如果是后者,那是不是跟 select col1,col2,row_number() over(order by col1,col2 asc) from table 执行结果是一致的