1 2 Previous Next 17 Replies Latest reply: May 1, 2013 2:40 AM by 1006212 RSS

    Doinng a join

    1006212
      Hello my dear Friends

      I have to tables

      country : name,code,...
      borders:country1,country2,lenght


      now i want to know if borders is asymetrical , symetrical means for every country if there is a (france,netherland,150) record in borders, there also should be ((neitherland,france,150) , otherwise it is asymetrical.

      so i think i should have a join between these two tables,
      this is my idea: if should test whether the count of country1 and country2 for every country is equal or not, if i count find a difference, then the borders table is asymetrical.

      if my idea is true, what is the sql command for it?

      thank you so much for your help


      best regards
        • 1. Re: Doinng a join
          sb92075
          How do I ask a question on the forums?
          SQL and PL/SQL FAQ

          we speak SQL?
          Do you speak SQL? If so, please be sure sure to post some in the future.
          • 2. Outer Self-Join
            Frank Kulash
            Hi,

            You can do a self-join, like this:
            SELECT     a.*
            ,     NVL2 ( b.country1
                      , 'Symmetrical'
                      , 'Asymmetrical'
                      )
            FROM          borders  a
            LEFT OUTER JOIN     borders  b  ON  b.country1     = a.country2
                                   AND     b.country2       = a.country1
                                   AND b.border_length = a.border_length
            ;
            LENGTH is the name of a built-in function, so it's not a good column name.


             

            I hope this answers your question.
            If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
            Explain, using specific examples, how you get those results from that data.
            Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
            See the forum FAQ {message:id=9360002}

            Edited by: Frank Kulash on Apr 30, 2013 11:17 AM
            1003209 wrote:
            ...
            (france,netherland,150) record in borders, there also should be ((neitherland,france,150)
            France and the Netherlands don't actually border each other, do they? (At least not now; maybe in Napoleon's time.)
            • 3. Re: Doinng a join
              1006212
              Yes, sure thank you
              • 4. Re: Doinng a join
                Arild
                You want to detect if one or more rows doesn't have a mate, is that it?
                WITH borders (country1, country2, length)
                     AS (SELECT 'FRANCE', 'BELGIUM', 150 FROM DUAL
                         UNION ALL
                         SELECT 'BELGIUM', 'FRANCE', 150 FROM DUAL
                         UNION ALL
                         SELECT 'NETHERLANDS', 'BELGIUM', 70 FROM DUAL) -- find me...
                
                SELECT b.country1, b.country2, b.length 
                FROM borders b
                MINUS
                SELECT b.country2, b.country1, b.length 
                FROM borders b
                ;
                • 5. Re: Outer Self-Join
                  1006212
                  Thank you very much

                  im using oracle 11g.
                  but i should mention that length field is actually no necessary for this problem. i deleted it.

                  also it should say 'yes asymetrical table ' or 'no symetrical table'


                  i'm sorry that my questions are very basic, since im beginner.


                  thank you so much in advance.
                  • 6. Re: Doinng a join
                    1006212
                    no Thank u i think its not the case, i explained above.
                    • 7. Re: Outer Self-Join
                      Frank Kulash
                      Hi,
                      1003209 wrote:
                      Thank you very much

                      im using oracle 11g.
                      but i should mention that length field is actually no necessary for this problem. i deleted it.
                      Then remove the join condition involving the length.
                      also it should say 'yes asymetrical table ' or 'no symetrical table'
                      Then where I said, 'Asymmetrical', you should say 'yes asymetrical table ', and where I said "Symmetrical', you should say 'no symetrical table'.
                      i'm sorry that my questions are very basic, since im beginner.
                      Basic questions are fine; incomplete questions are bad.
                      Always post CREATE TABLE and INSERT statements for a little sample data (or a WITH clause, like Arild did), and the exact results you want from that data.
                      thank you so much in advance.
                      Isn't your problem solved now? What's wrong with the solutions already given? When you post the sample data and results, post your best attempt based on the solutions above. Point out where it is getting the wrong results, and explain how you get the right results in those places.
                      • 8. Re: Outer Self-Join
                        1006212
                        Dear Frank thank you very much
                        but i mean it should not generate a lot of record but just print out 'yes' or 'no'
                        if there is at least one no, the answer is no, if thee are just yes, the answer is yes.
                        • 9. Re: Outer Self-Join
                          1006212
                          i wrote more details in a seperate thread

                          SELECT     NVL2 ( b.country1
                          , 'No'
                          , 'Yes'
                          )
                          FROM     borders a
                          LEFT OUTER JOIN     borders b ON b.country1     = a.country2
                          AND     b.country2 = a.country1;

                          now i want to chage it, i want to output yes or no:
                          if there is at list one no , the answer is no, otherwise yes, it means if all are yes it its yes.

                          i mean it should not generate a lot of record but just print out 'yes' or 'no'
                          if there is at least one no, the answer is no, if thee are just yes, the answer is yes.
                          • 10. Re: Outer Self-Join
                            ranit B
                            Not tested
                             SELECT     
                                 case when
                                 (SUM(     
                                      NVL2 ( b.country1
                                       , 1 --'No'
                                       , 0 --'Yes'
                                     )
                                         ) OVER()) >0
                                 then 'NO' else 'YES'
                             FROM      borders a
                             LEFT OUTER JOIN     borders b ON b.country1     = a.country2
                             AND     b.country2 = a.country1;
                            -OR- this :
                             SELECT     
                                 case when
                                 (MAX(     
                                      NVL2 ( b.country1
                                       , 1 --'No'
                                       , 0 --'Yes'
                                         )
                                            )
                                  )>0
                                 then 'NO' else 'YES'
                             FROM      borders a
                             LEFT OUTER JOIN     borders b ON b.country1     = a.country2
                             AND     b.country2 = a.country1;
                            • 11. Re: Outer Self-Join
                              Frank Kulash
                              Hi,
                              1003209 wrote:
                              i wrote more details in a seperate thread
                              Do you mean {message:id=10903971}? It acually has fewer details, and no sample data.
                              SELECT     NVL2 ( b.country1
                              , 'No'
                              , 'Yes'
                              )
                              FROM     borders a
                              LEFT OUTER JOIN     borders b ON b.country1     = a.country2
                              AND     b.country2 = a.country1;

                              now i want to chage it, i want to output yes or no:
                              if there is at list one no , the answer is no, otherwise yes, it means if all are yes it its yes.

                              i mean it should not generate a lot of record but just print out 'yes' or 'no'
                              if there is at least one no, the answer is no, if thee are just yes, the answer is yes.
                              It sounds like an EXISTS sub-query, with a self-join in the sub-query, would do that. If you'd like help, then post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data. Include examples of any special cases you need to handle (e.g., a country with no borders).
                              • 12. Re: Outer Self-Join
                                1006212
                                Thank you very much


                                --------------------------------------------------------
                                -- File created - Tuesday-April-30-2013
                                --------------------------------------------------------
                                --------------------------------------------------------
                                -- DDL for Table BORDERS
                                --------------------------------------------------------

                                CREATE TABLE "intern"."BORDERS"
                                (     "COUNTRY1" CHAR(2 BYTE),
                                     "COUNTRY2" CHAR(2 BYTE),
                                     "LENGTH" NUMBER
                                ) SEGMENT CREATION IMMEDIATE
                                PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
                                STORAGE(INITIAL 57344 NEXT 57344 MINEXTENTS 1 MAXEXTENTS 2147483645
                                PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
                                TABLESPACE "STUDENT" ;


                                COMMENT ON COLUMN "intern"."BORDERS"."COUNTRY1" IS 'a country code';

                                COMMENT ON COLUMN "intern"."BORDERS"."COUNTRY2" IS 'a country code';

                                COMMENT ON COLUMN "intern"."BORDERS"."LENGTH" IS 'length of the border between country1 and country2';

                                COMMENT ON TABLE "intern"."BORDERS" IS 'informations about neighboring countries';
                                REM INSERTING into intern.BORDERS
                                SET DEFINE OFF;
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ad','es',63);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ad','fr',56);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ae','om',410);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ae','sa',457);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('af','cn',76);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('af','ir',936);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('af','pk',2430);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('af','tj',1206);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('af','tm',744);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('af','uz',137);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('al','gr',282);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('al','mk',151);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('al','yu',287);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('am','az',787);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('am','ge',164);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('am','ir',35);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('am','tr',268);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('an','gp',10);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ao','cd',2712);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ao','cg',201);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ao','na',1376);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ao','zm',1110);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ar','bo',832);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ar','br',1224);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ar','cl',5150);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ar','py',1880);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ar','uy',579);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('at','ch',164);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('at','cz',362);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('at','de',784);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('at','hu',366);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('at','it',430);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('at','li',35);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('at','si',330);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('at','sk',91);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('az','ge',322);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('az','ir',611);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('az','ru',284);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('az','tr',9);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ba','hr',932);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ba','yu',527);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bd','in',4053);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bd','mm',193);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('be','de',167);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('be','fr',620);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('be','lu',148);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('be','nl',450);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','bj',306);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','ci',584);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','gh',549);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','ml',1000);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','ne',628);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','tg',126);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','gr',494);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','mk',148);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','ro',608);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','tr',240);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','yu',318);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bi','cd',233);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bi','rw',290);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bi','tz',451);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bj','ne',266);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bj','ng',773);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bj','tg',644);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bn','my',381);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bo','br',3400);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bo','cl',861);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bo','pe',900);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bo','py',750);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','co',1643);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','gf',673);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','gy',1119);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','pe',1560);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','py',1290);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','sr',597);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','uy',985);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','ve',2200);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bt','cn',470);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bt','in',605);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bw','na',1360);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bw','za',1840);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bw','zw',813);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('by','lt',502);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('by','lv',141);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('by','pl',407);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('by','ru',959);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('by','ua',891);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bz','gt',266);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bz','mx',250);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ca','us',8893);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cd','cf',1577);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cd','cg',2410);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cd','rw',217);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cd','sd',628);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cd','tz',459);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cd','ug',765);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cd','zm',1930);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cf','cg',467);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cf','cm',797);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cf','sd',1165);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cf','td',1197);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cg','cm',523);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('cg','ga',1903);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ch','de',334);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ch','fr',573);
                                Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ch','it',740);

                                --------------------------------------------------------
                                -- DDL for Index BORDERS_KEY
                                --------------------------------------------------------

                                CREATE UNIQUE INDEX "intern"."BORDERS_KEY" ON "intern"."BORDERS" ("COUNTRY1", "COUNTRY2")
                                PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
                                STORAGE(INITIAL 57344 NEXT 57344 MINEXTENTS 1 MAXEXTENTS 2147483645
                                PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
                                TABLESPACE "STUDENT" ;
                                --------------------------------------------------------
                                -- Constraints for Table BORDERS
                                --------------------------------------------------------

                                ALTER TABLE "intern"."BORDERS" ADD CONSTRAINT "BORDERS_KEY" PRIMARY KEY ("COUNTRY1", "COUNTRY2")
                                USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
                                STORAGE(INITIAL 57344 NEXT 57344 MINEXTENTS 1 MAXEXTENTS 2147483645
                                PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
                                TABLESPACE "STUDENT" ENABLE;

                                ALTER TABLE "intern"."BORDERS" ADD CONSTRAINT "BORDERS_LENGTH_CHECK" CHECK (
                                Length > 0
                                ) ENABLE;







                                now if i could find one data like germany and france and there is not record like france and germany, so it means that the table is assymetrical and the answer is no

                                if all the data is syymetrical means for all records like germany, france there is france germany , so it is no assymetrical


                                i hope now it is clear.
                                • 13. Re: Outer Self-Join
                                  Frank Kulash
                                  Hi,
                                  1003209 wrote:
                                  ... now if i could find one data like germany and france and there is not record like france and germany, so it means that the table is assymetrical and the answer is no
                                  I can guess that 'fr' stands for France, but what about Germany? I see both 'ge' and 'de' in the data, but neither is realted to 'fr'.
                                  i hope now it is clear.
                                  It's a big step in the right direction. You still need to post the exact, complete results you want from the sample data you posted.

                                  Not everyone who wants to help you has a schema called "intern" (especially with the double-quotes) or a tablespace called student, so these things need to be edited out. It doesn't take very much time, but if you can't be bothered to do it, why should anyone else?

                                  LENGTH is still a bad column name. Earlier, you said you deleted it; why did you put it back again?

                                  Do you really need this much sample data to show what the problem is? If you could do it with maybe 10 rows of sample data data, and 4 rows of results, wouldn't that be easier for you (and everyone else)?
                                  • 14. Re: Outer Self-Join
                                    1006212
                                    lets just consider this


                                    insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ba','hr',932);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ba','yu',527);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bd','in',4053);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bd','mm',193);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('be','de',167);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('be','fr',620);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('be','lu',148);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('be','nl',450);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','bj',306);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','ci',584);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','gh',549);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','ml',1000);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','ne',628);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bf','tg',126);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','gr',494);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','mk',148);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','ro',608);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','tr',240);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bg','yu',318);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bi','cd',233);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bi','rw',290);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bi','tz',451);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bj','ne',266);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bj','ng',773);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bj','tg',644);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bn','my',381);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bo','br',3400);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bo','cl',861);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bo','pe',900);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bo','py',750);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','co',1643);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','gf',673);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','gy',1119);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','pe',1560);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','py',1290);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','sr',597);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','uy',985);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('br','ve',2200);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bt','cn',470);
                                    Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('bt','in',605);



                                    for example bf,bj exists but bj,bf does not
                                    1 2 Previous Next