Question : how to exclude double

Hi,
I have the following sql script file for Oracle:
LTER TABLE person
  DROP PRIMARY KEY CASCADE;

DROP TABLE person;

CREATE TABLE person
(nr        NUMBER(2),
 fornavn   VARCHAR2(10),
 etternavn VARCHAR2(15),
 enr       NUMBER(2),
 CONSTRAINT person_nr_pk
   PRIMARY KEY(nr),
 CONSTRAINT person_enr_fk
   FOREIGN KEY(enr)
   REFERENCES person(nr));

INSERT INTO person VALUES(1,'KARI','HAV',NULL);
INSERT INTO person VALUES(2,'JENS','OLSEN',NULL);
INSERT INTO person VALUES(3,'EVA','STAAL',NULL);
INSERT INTO person VALUES(4,'PER','HAV',NULL);
INSERT INTO person VALUES(5,'OLA','HALL',NULL);
INSERT INTO person VALUES(6,'OLE','SUND',NULL);
INSERT INTO person VALUES(7,'EVA','PERSEN',NULL);
INSERT INTO person VALUES(8,'BRIT','ALVEN',NULL);
INSERT INTO person VALUES(9,'KNUT','JENSEN',NULL);
INSERT INTO person VALUES(10,'LIV','ALTEN',NULL);
INSERT INTO person VALUES(11,'KARI','NORMANN',NULL);
INSERT INTO person VALUES(12,'OLA','NORMANN',NULL);
INSERT INTO person VALUES(15,'PETRA','SAND',NULL);

UPDATE person SET enr=4  WHERE nr = 1;
UPDATE person SET enr=10  WHERE nr = 2 ;
UPDATE person SET enr=6  WHERE nr = 3;
UPDATE person SET enr=1  WHERE nr = 4;
UPDATE person SET enr=7  WHERE nr = 5;
UPDATE person SET enr=3  WHERE nr = 6;
UPDATE person SET enr=5  WHERE nr = 7;
UPDATE person SET enr=2  WHERE nr = 10;
UPDATE person SET enr=11  WHERE nr = 12;
UPDATE person SET enr=12  WHERE nr = 11;

where "nr" ir a person number and  "enr" is a spouse number.

The task is to find all the married couples. That goes fine. But the I have been asked to exclude repertition (i.e instead of husband-wife and wife-husband rows in a result the should be only one row, one of these two)

Answer : how to exclude double

the recommended topology for your scenario would look like the diagrams below.

the first solution separates all subnets with each other using a central firewall. RDP access from PROD to DEV can be implemented using NAT port forwarding or ACL based routing. this approach normally needs a high-end firewall if high performance is required.

if you don't have the multi-interface firewall demanded in the above approach, you may consider the second solution which puts all subnets sequentially. the PROD subnet is the most internal network, and DMZ is the edge to the internet. PROD users can of course access all hosts in DEV (or can be restricted by specific rules) as the DEV subnet is among PROD's route to the internet. the same thing for DMZ.

hope it helps,
bbao
1:
2:
3:
4:
5:
6:
7:
8:
9:
                  DMZ
                   |
<--- PROD ---> FIREWALL <--- DEV --->
                   |
               INTERNET

                   or

<-- PROD ---> ROUTER <--- DEV ---> ROUTER/FIREWALL <--- DMZ ---> FIREWALL <--- INTERNET --->
Random Solutions  
 
programming4us programming4us