query [message #644068] |
Tue, 27 October 2015 15:09 |
|
chatwidravi
Messages: 3 Registered: August 2013 Location: bangalore
|
Junior Member |
|
|
CREATE TABLE TEST (ENAME VARCHAR2(4),DEPTNO NUMBER);
INSERT INTO TEST VALUES('A',10);
INSERT INTO TEST VALUES('B',20);
INSERT INTO TEST VALUES('C',30);
Test
-----------------
ename deptno
A 10
B 20
C 30
Output of table should be like this:
ename deptno
A 30
B 20
C 10
|
|
|
Re: query [message #644070 is a reply to message #644068] |
Tue, 27 October 2015 15:15 |
John Watson
Messages: 8931 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
College homework question? You need to show what you have tried so far. I would use a subquery factoring clause (probably two of them) to construct views, which I would then join.
|
|
|
|
|
Re: query [message #644073 is a reply to message #644072] |
Tue, 27 October 2015 15:41 |
John Watson
Messages: 8931 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I would use simpler subqueries. For example,orclz> select deptno,rownum join_col from (select deptno from test order by deptno desc) ;
DEPTNO JOIN_COL
---------- ----------
30 1
20 2
10 3
orclz> select ename,rownum join_col from (select ename from test order by ename) ;
ENAM JOIN_COL
---- ----------
A 1
B 2
C 3
orclz> but using analytic queries might get you higher marks.
|
|
|
|
|
Re: query [message #644218 is a reply to message #644213] |
Fri, 30 October 2015 11:23 |
|
Michel Cadot
Messages: 68648 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
If I was you I'd not expect any answer to your question from OP which posts questions, gets answers but will come back only if he has another question.
[Updated on: Fri, 30 October 2015 11:24] Report message to a moderator
|
|
|