Quantcast
Channel: Question and Answer » oracle-12c
Viewing all articles
Browse latest Browse all 41

Help with query to find intersection between arbitary rows of a table under conditions

$
0
0
CREATE TABLE "SYSTEM"."SAMPLE" 
   ("E1" VARCHAR2(20 BYTE), 
    "E2" VARCHAR2(20 BYTE), 
    "E3" VARCHAR2(20 BYTE), 
    "E4" VARCHAR2(20 BYTE)
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM" ;

I am from mathematics background need help to write query for the below mentioned question help

I have given only some amount of the data as i cannot attach a file all [a,b] each treated as string and a < b maintained to uniques are such that a

E1       E2      E3      E4

[0,2]   [1,2]   [2,3]   [3,4]

[0,2]   [1,2]   [2,4]   [3,4]

[0,3]   [1,3]   [2,3]   [2,4]

[0,3]   [1,3]   [3,4]   [2,4]

[0,4]   [1,4]   [2,4]   [2,3]
%
[0,4]   [1,4]   [3,4]   [2,3]

Question help

N+1 rows of N elements, such than there are N*(N+1) / 2 total elements, each duplicated twice. Further more, the intersection of any two rows is exactly 1 element.

Example:

(0,1), (0,2), (0,3), (3,4)

(0,1), (1,3), (1,2), (2,4)

(0,2), (2,3), (1,2), (1,4)

(1,4), (2,4), (0,4), (0,3)

Each row contains each line of above and each column contains (0,1) next (0,2) etc so there are 4 columns and we have to choose 5 rows with five columns like this u can see the intersection there I feel.


Viewing all articles
Browse latest Browse all 41

Trending Articles