菜鸟来问下ORACLE中怎么给一个视图加一个ID列,如何用rownum
3个回答
展开全部
SELECT ROWNUM rn,v.* FROM view_test v;
输出:
RN ID DEPTNO DNAME
1 1 20 RESEARCH
2 2 30 SALES
3 3 30 SALES
4 4 20 RESEARCH
5 5 30 SALES
6 6 30 SALES
7 7 10 ACCOUNTING
8 8 10 ACCOUNTING
9 9 30 SALES
10 10 30 SALES
11 11 20 RESEARCH
12 12 10 ACCOUNTING
13 13 20 RESEARCH
输出:
RN ID DEPTNO DNAME
1 1 20 RESEARCH
2 2 30 SALES
3 3 30 SALES
4 4 20 RESEARCH
5 5 30 SALES
6 6 30 SALES
7 7 10 ACCOUNTING
8 8 10 ACCOUNTING
9 9 30 SALES
10 10 30 SALES
11 11 20 RESEARCH
12 12 10 ACCOUNTING
13 13 20 RESEARCH
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询