Inner join for two tables

Hello All
i have these to tables
country: name,population
borders: country1,country2
every country have some neghbors, in borders table,
now i should calculate sum of pupulation of all neighbors of every country
thank u so much for ur help
I use oracle 11g
best

This is the SQL to create the table
now i hope i will get an answer
--  File created - Tuesday-April-30-2013  
--  DDL for Table BORDERS
  CREATE TABLE "intern"."BORDERS" ("COUNTRY1" CHAR(2), "COUNTRY2" CHAR(2), "LENGTH" NUMBER)
   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 ('md','ua',939);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mk','yu',221);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ml','mr',2237);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ml','ne',821);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ml','sn',419);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mm','th',1800);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mn','ru',3543);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mr','sn',813);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mw','mz',1569);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mw','tz',475);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mw','zm',837);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mx','us',3141);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('my','th',506);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mz','sz',105);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mz','tz',756);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mz','za',491);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mz','zm',419);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('mz','zw',1231);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('na','za',967);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('na','zm',233);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ne','ng',1497);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ne','td',1175);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ng','td',87);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('no','ru',196);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('no','se',1619);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('om','sa',676);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('om','ye',288);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('pl','ru',206);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('pl','sk',444);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('pl','ua',526);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('qa','sa',60);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ro','ua',531);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ro','yu',476);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('ru','ua',1576);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('rw','tz',217);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('rw','ug',169);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('sa','ye',1458);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('sd','td',1360);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('sd','ug',435);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('sk','ua',97);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('sy','tr',822);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('sz','za',430);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('tj','uz',1161);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('tm','uz',1621);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('tz','ug',396);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('tz','zm',338);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('za','zw',225);
Insert into intern.BORDERS (COUNTRY1,COUNTRY2,LENGTH) values ('zm','zw',797);
--  DDL for Index BORDERS_KEY
  CREATE UNIQUE INDEX "intern"."BORDERS_KEY" ON "intern"."BORDERS" ("COUNTRY1", "COUNTRY2")
--  Constraints for Table BORDERS
  ALTER TABLE "intern"."BORDERS" ADD CONSTRAINT "BORDERS_KEY" PRIMARY KEY ("COUNTRY1", "COUNTRY2") ENABLE
  ALTER TABLE "intern"."BORDERS" ADD CONSTRAINT "BORDERS_LENGTH_CHECK" CHECK (
             Length > 0
        ) ENABLE
--  File created - Tuesday-April-30-2013  
--  DDL for Table COUNTRY
  CREATE TABLE "intern"."COUNTRY" ("NAME" VARCHAR2(40), "CODE" CHAR(2), "CAPITAL" VARCHAR2(40), "PROVINCE" VARCHAR2(40), "POPULATION" NUMBER, "AREA" NUMBER)
   COMMENT ON COLUMN "intern"."COUNTRY"."NAME" IS 'the country name'
   COMMENT ON COLUMN "intern"."COUNTRY"."CODE" IS 'the internet country code (two letters)'
   COMMENT ON COLUMN "intern"."COUNTRY"."CAPITAL" IS 'the name of the capital'
   COMMENT ON COLUMN "intern"."COUNTRY"."PROVINCE" IS 'the province where the capital belongs to'
   COMMENT ON COLUMN "intern"."COUNTRY"."POPULATION" IS 'the population number'
   COMMENT ON COLUMN "intern"."COUNTRY"."AREA" IS 'the total area'
   COMMENT ON TABLE "intern"."COUNTRY"  IS 'the countries of the world with some data'
REM INSERTING into intern.COUNTRY
SET DEFINE OFF;
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Andorra','ad','Andorra la Vella','Andorra la Vella',69865,468);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('United Arab Emirates','ae','Abu Dhabi','Abu Dhabi',2523915,82880);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Afghanistan','af','Kabul','Kabul',28513677,647500);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Antigua and Barbuda','ag','Saint Johns','Saint John',68320,442.6);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Netherlands','nl','Amsterdam','Noord-Holland',16318199,41526);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Norway','no','Oslo','Akershus',4574560,324220);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Nepal','np','Kathmandu','Kathmandu',27070666,140800);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Nauru','nr',null,null,12809,21);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Niue','nu',null,null,2156,260);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('New Zealand','nz','Wellington','Wellington',3993817,268680);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Oman','om','Muscat','Muscat',2903165,212460);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Panama','pa','Panama','Panama',3000463,78200);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Peru','pe','Lima','Lima y Callao',27544305,1285220);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('French Polynesia','pf','Papeete','Iles du Vent',266339,4167);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Papua New Guinea','pg','Port Moresby','National Capital District',5420280,462840);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Philippines','ph','Manila','National Capital Region',86241697,300000);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Pakistan','pk','Islamabad','Federal Capital Area',159196336,803940);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Poland','pl','Warsaw','Mazowieckie',38626349,312685);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Saint Pierre and Miquelon','pm','Saint-Pierre','Saint-Pierre',6995,242);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Pitcairn Islands','pn',null,null,46,47);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Puerto Rico','pr','San Juan','San Juan',3897960,9104);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Palestine','ps','Ramallah','Gaza Strip',3762005,6220);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Portugal','pt','Lisbon','Lisboa e Vale do Tejo',10524145,92391);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Palau','pw','Koror','Koror',20016,458);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Paraguay','py','Asuncion','Asuncion',6191368,406750);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Qatar','qa','Doha','Doha',840290,11437);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Reunion','re','Saint-Denis','Saint-Denis',766153,2517);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Romania','ro','Bucharest','Bucharest',22355551,237500);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Russia','ru','Moscow','Moscow',143782338,17075200);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Rwanda','rw','Kigali','Ville de Kigali',7954013,26338);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Saudi Arabia','sa','Riyadh','Riyadh',25795938,1960582);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Solomon Islands','sb','Honiara','Guadalcanal',523617,28450);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Seychelles','sc',null,null,80832,455);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Sudan','sd','Khartoum','Khartoum',39148162,2505810);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Sweden','se','Stockholm','Stockholm',8986400,449964);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Singapore','sg',null,null,4353893,692.7);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Saint Helena','sh','Jamestown','Saint Helena',7415,410);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Slovenia','si','Ljubljana','Osrednjeslovenska',2011473,20273);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Svalbard','sj','Longyearbyen','Svalbard',2756,62049);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Slovakia','sk','Bratislava','Bratislavsky',5423567,48845);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Sierra Leone','sl','Freetown','Western',5883889,71740);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('San Marino','sm','San Marino','San Marino',28503,61.2);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Senegal','sn','Dakar','Dakar',10852147,196190);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Somalia','so','Mogadishu','Banadir',8304601,637657);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Suriname','sr','Paramaribo','Paramaribo',436935,163270);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Sao Tome and Principe','st','Sao Tome','Agua Grande',181565,1001);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('El Salvador','sv','San Salvador','San Salvador',6587541,21040);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Syria','sy','Damascus','Damascus',18016874,185180);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Swaziland','sz','Mbabane','Hhohho',1169241,17363);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Turks and Caicos Islands','tc',null,null,19956,430);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Chad','td','NDjamena','Chari-Baguirmi',9538544,1284000);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Togo','tg','Lome','Maritime',5556812,56785);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Thailand','th','Bangkok','Bangkok Metropolitan Area',64865523,514000);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Tajikistan','tj','Dushanbe','Dushanbe',7011556,143100);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Tokelau','tk',null,null,1405,10);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Turkmenistan','tm','Asgabat','Asgabat',4863169,488100);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Tunisia','tn','Tunis','Tunis',9974722,163610);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Tonga','to','Nukualofa','Tongatapu',110237,748);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('East Timor','tp','Dili','Dili',1019252,15007);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Turkey','tr','Ankara','Ankara',68893918,780580);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Trinidad and Tobago','tt','Port of Spain','Port of Spain',1096585,5128);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Tuvalu','tv','Vaiaku','Funafuti',11468,26);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Taiwan','tw','Taipei','Taipei Hsien',22749838,35980);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Tanzania','tz','Dar es Salaam','Dar es Salaam',36588225,945087);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Ukraine','ua','Kiev','Kiev',47732079,603700);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Uganda','ug','Kampala','Central',26404543,236040);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('United Kingdom','uk','London','England',60270708,244820);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('United States','us','Washington','District of Columbia',293027571,9631418);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Uruguay','uy','Montevideo','Montevideo',3399237,176220);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Uzbekistan','uz','Tashkent','Tashkent',26410416,447400);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Holy See','va',null,null,921,0.44);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Saint Vincent and the Grenadines','vc','Kingstown','Saint George',117193,389);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Venezuela','ve','Caracas','Distrito Capital',25017387,912050);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('British Virgin Islands','vg','Road Town','Tortola',22187,153);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Virgin Islands','vi','Charlotte Amalie','Saint Thomas',108775,352);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Vietnam','vn','Ha Noi','Dong Bang Song Hong',82689518,329560);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Vanuatu','vu','Vila','Shefa',202609,12200);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Wallis and Futuna','wf','Matautu','Hahake',15880,274);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Samoa','ws','Apia','Apia Urban Area',177714,2944);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Yemen','ye','Sana','Amanah al-Asmah',20024867,527970);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Mayotte','yt','Mamoudzou','Mayotte',186026,374);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Serbia and Montenegro','yu','Belgrade','Central Serbia',10825900,102350);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('South Africa','za','Pretoria','Gauteng',42718530,1219912);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Zambia','zm','Lusaka','Lusaka',10462436,752614);
Insert into intern.COUNTRY (NAME,CODE,CAPITAL,PROVINCE,POPULATION,AREA) values ('Zimbabwe','zw','Harare','Harare',12671860,390580);
--  DDL for Index COUNTRY_KEY
  CREATE UNIQUE INDEX "intern"."COUNTRY_KEY" ON "intern"."COUNTRY" ("CODE")
--  DDL for Index COUNTRY_NAME_UNIQUE
  CREATE UNIQUE INDEX "intern"."COUNTRY_NAME_UNIQUE" ON "intern"."COUNTRY" ("NAME")
--  Constraints for Table COUNTRY
  ALTER TABLE "intern"."COUNTRY" ADD CONSTRAINT "COUNTRY_AREA_CHECK" CHECK (
             Area >= 0
        ) ENABLE
  ALTER TABLE "intern"."COUNTRY" ADD CONSTRAINT "COUNTRY_KEY" PRIMARY KEY ("CODE") ENABLE
  ALTER TABLE "intern"."COUNTRY" MODIFY ("NAME" CONSTRAINT "COUNTRY_NAME_NOTNULL" NOT NULL ENABLE)
  ALTER TABLE "intern"."COUNTRY" ADD CONSTRAINT "COUNTRY_NAME_UNIQUE" UNIQUE ("NAME") ENABLE
  ALTER TABLE "intern"."COUNTRY" ADD CONSTRAINT "COUNTRY_POPULATION_CHECK" CHECK (
             Population >= 0
        ) ENABLE

Similar Messages

  • Inner join for three table

    dear friends
    kna1- kunnr ,name1
    vbak - vbeln , erdat
    vbap - meins , kwmeng
    on above i have given three tables and their fields in front of this
    can any one tel me how to give inner join in select statement for the above tables

    Hi Create an appropriate internal table ITAB
    Select VBAK~VBELN
               VBAK~ERDAT
               VBAP~POSNR
               VBAP~MEINS
               VBAP~kwmeng
               KNA1~KUNNR
               KNA1~NAME1
    From VBAK
    Into Table ITAB
    Inner Join VBAP On VBAKVBELN = VBAPVBELN
    Inner Join KNA1 On VBAK~KUNNR = KNA1-KUNNR
    Where VBAK~VBELN In S_VBELN.
    Santhosh

  • Problem when doing inner join for three tables....

    DATA: V3 TYPE VBAP-MAKTL.
    SELECT single vbap~matkl into V3
           from VBAP
           inner join VBFA
           inner join LIPS
              on LIPSPOSNR = VBFAPOSNN
              and vbapvbeln = vbfavbelv
               and vbapposnr = vbfaposnv
                 where LIPSVBELN = VBFAVBELN = '0080000834'
                 and vbfa~vbtyp_n = 'J'
                 and LIPS~J_3ASIZE = '0884'.
    Error: Wrong expression "INNER" in from clause...

    Hello Tushar,
      Why you are using the 3 table inner join. If the volume of data is big then this statement will give to time out. Use "for all entries" statement to select the data from the table.
    Like
    select field1 field2 from LIPS into i_lips
        where LIPS~J_3ASIZE = '0884'.
    select f3 f4 from vbfa into i_vbfa for all entries in i_lips where field1 = i_lips-field1 and so on
    and 
    use same to select data from VBAP.
    Hope this will help

  • Inner Join between two big tables

    Hi There,
    I have a situation where in which I have to write an inner join between two table of the order of (30k to 60 rows).
    My query is as simple as,
    select A.a,B.b from A ,B where A.a = B.b;
    N.B: a and b are of type varchar
    But the problem is it takes nearly 15 mins to run. Is there any better way of doing an inner join between such bigger tables?
    Thanks,
    Jose John.

    Thank you all for your help.....Indexing works....:)
    --JJ                                                                                                                                                                                                   

  • Can we implement the custom sql query in CR for joining the two tables

    Hi All,
    Is there anyway to implement the custom sql query in CR for joining the two tables?
    My requirement here is I need to write sql logics for joining the two tables...
    Thanks,
    Gana

    In the Database Expert, expand the Create New Connection folder and browse the subfolders to locate your data source.
    Log on to your data source if necessary.
    Under your data source, double-click the Add Command node.
    In the Add Command to Report dialog box, enter an appropriate query/command for the data source you have opened.
    For example:
    SELECT
        Customer.`Customer ID`,
        Customer.`Customer Name`,
        Customer.`Last Year's Sales`,
        Customer.`Region`,
        Customer.`Country`,
        Orders.`Order Amount`,
        Orders.`Customer ID`,
        Orders.`Order Date`
    FROM
        Customer Customer INNER JOIN Orders Orders ON
            Customer.`Customer ID` = Orders.`Customer ID`
    WHERE
        (Customer.`Country` = 'USA' OR
        Customer.`Country` = 'Canada') AND
        Customer.`Last Year's Sales` < 10000.
    ORDER BY
        Customer.`Country` ASC,
        Customer.`Region` ASC
    Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
    Optionally, you can create a parameter for your command by clicking Create and entering information in the Command Parameter dialog box.
    For more information about creating parameters, see To create a parameter for a command object.
    Click OK.
    You are returned to the Report Designer. In the Field Explorer, under Database Fields, a Command table appears listing the database fields you specified.
    Note:
    To construct the virtual table from your Command, the command must be executed once. If the command has parameters, you will be prompted to enter values for each one.
    By default, your command is called Command. You can change its alias by selecting it and pressing F2.

  • WHERE clause creating a join for two or more tables

    The CS3 Dreamweaver book says that the WHERE clause can
    create a join for two or more tables. The join was created, but the
    data is repeating. I have searched the web and this forum and have
    not found the answer.
    My Master page filters the recordset by Style No and when a
    customer clicks on a particular style, it sends him to the Detail
    page. All the records are showing from all tables on the detail
    page from the Dynamic List, except they are showing multiple times
    (ex. Size table has 4 sizes and Color table has 2 colors - my Size
    Drop Down list is showing 8 options and my Color Drop Down List is
    showing 8 options) I have a Master Page with a recordset pointing
    to a Detail Page using the same recordset.
    Master page works perfectly.
    Master Recordset SQL:
    SELECT products.itemID, products.category, products.styleno,
    products.name, products.description, products.ourprice,
    products.imageTH, products.image, coloroption.color,
    sizeoption.size
    FROM products, coloroption, sizeoption
    WHERE category = 'chefcoats' AND
    products.styleno=sizeoption.styleno AND
    products.styleno=coloroption.styleno
    GROUP BY products.styleno
    ORDER BY styleno ASC
    The Detail Recordset:
    SELECT products.itemID, products.category, products.styleno,
    products.name, products.description, products.ourprice,
    products.imageTH, products.image, sizeoption.size,
    coloroption.color
    FROM products, sizeoption, coloroption
    WHERE itemID=colname AND products.styleno=sizeoption.styleno
    AND products.styleno=coloroption.styleno
    I tried using the GROUP BY on the detail page, but then it
    only showed one size and color from the dynamic drop down list. I
    tried changing the field name "styleno" in the other tables to be
    unique, however, I was using the table identifer. I tried using the
    JOIN command instead of the WHERE clause and that didn't help
    either.
    On the detail page, the customer is supposed to click on the
    Size box and see sizes XSM - 6XL ONLY ONE TIME. and then be able to
    click on the Color option and see White, Black, Red ONE TIME.
    Is this possible?
    Thank you for giving your time to read this.!
    Evie

    Do you have a link we can look at to see what you are trying
    to do?
    Dave
    "EviePhillips" <[email protected]> wrote in
    message
    news:[email protected]...
    > The CS3 Dreamweaver book says that the WHERE clause can
    create a join for
    two
    > or more tables. The join was created, but the data is
    repeating. I have
    > searched the web and this forum and have not found the
    answer.
    >
    > My Master page filters the recordset by Style No and
    when a customer
    clicks on
    > a particular style, it sends him to the Detail page. All
    the records are
    > showing from all tables on the detail page from the
    Dynamic List, except
    they
    > are showing multiple times (ex. Size table has 4 sizes
    and Color table has
    2
    > colors - my Size Drop Down list is showing 8 options and
    my Color Drop
    Down
    > List is showing 8 options) I have a Master Page with a
    recordset pointing
    to a
    > Detail Page using the same recordset.
    >
    > Master page works perfectly.
    > Master Recordset SQL:
    > SELECT products.itemID, products.category,
    products.styleno,
    products.name,
    > products.description, products.ourprice,
    products.imageTH, products.image,
    > coloroption.color, sizeoption.size
    > FROM products, coloroption, sizeoption
    > WHERE category = 'chefcoats' AND
    products.styleno=sizeoption.styleno AND
    > products.styleno=coloroption.styleno
    > GROUP BY products.styleno
    > ORDER BY styleno ASC
    >
    > The Detail Recordset:
    > SELECT products.itemID, products.category,
    products.styleno,
    products.name,
    > products.description, products.ourprice,
    products.imageTH, products.image,
    > sizeoption.size, coloroption.color
    > FROM products, sizeoption, coloroption
    > WHERE itemID=colname AND
    products.styleno=sizeoption.styleno AND
    > products.styleno=coloroption.styleno
    >
    > I tried using the GROUP BY on the detail page, but then
    it only showed
    one
    > size and color from the dynamic drop down list. I tried
    changing the
    field
    > name "styleno" in the other tables to be unique,
    however, I was using the
    table
    > identifer. I tried using the JOIN command instead of the
    WHERE clause and
    that
    > didn't help either.
    >
    > On the detail page, the customer is supposed to click on
    the Size box and
    see
    > sizes XSM - 6XL ONLY ONE TIME. and then be able to click
    on the Color
    option
    > and see White, Black, Red ONE TIME.
    >
    > Is this possible?
    >
    > Thank you for giving your time to read this.!
    > Evie
    >
    >

  • How to use inner joins for 4 0r 5 tables

    Hai Experts,
    plz check my code, n plz help to inner join all the tables
    TYPES : BEGIN OF ITAB,
           EBELN TYPE EKKO-EBELN,            "P.O.NUMBER
           AEDAT TYPE EKKO-AEDAT,            "DATE
           BPRME TYPE EKPO-BPRME,            "UNIT PRICE
           MENGE TYPE EKPO-MENGE,            "Purchase order quantity
           WERKS TYPE EKPO-WERKS,            "PLANT
           BRTWR TYPE EKPO-BRTWR,            "Gross order value in PO
           STRAS TYPE LFA1-STRAS,            "House number and street
           LIFNR TYPE LFA1-LIFNR,            "VENDOR NO
           NAME1 TYPE LFA1-NAME1,            "V NAME
           ORT01 TYPE LFA1-ORT01,            "CITY
           LAND1 TYPE LFA1-LAND1,            "LAND
           PSTLZ TYPE LFA1-PSTLZ,             "POSTAL CODE
           MAKTX TYPE MAKT-MAKTX,            "DESCRIPTION
    END OF ITAB.
    <b>and i got stucked here:</b>
    <u></u>
    SELECT EKKO~EBELN
             EKKO~AEDAT
             EKPO~BPRME
             EKPO~MENGE
             EKPO~WERKS
             EKPO~BRTWR
             LFA1~LIFNR
             LFA1~STRAS
             LFA1~NAME1
             LFA1~ORT01
             LFA1~LAND1
             LFA1~PSTLZ
             MAKT~MAKTX
             INTO TABLE ITAB
             FROM EKKO
             INNER JOIN EKPO LFA1 T001W MAKT
             ON EKKOEBELN = EKPOEBELN
                EKKO~EBELN
             WHERE EKKO~EBELN IN S_EBELN.

    hi Rajesh,
    you have to join the tables one by one:
    SELECT ekko~ebeln
                 ekko~aedat
                 ekpo~bprme
                 ekpo~menge
                 ekpo~werks
                 ekpo~brtwr
                 lfa1~lifnr
                 lfa1~stras
                 lfa1~name1
                 lfa1~ort01
                 lfa1~land1
                 lfa1~pstlz
                 makt~maktx
    INTO TABLE itab
    FROM ekko AS ekko
    INNER JOIN ekpo AS ekpo
    ON ekkoebeln EQ ekpoebeln
    INNER JOIN lfa1 AS lfa1
    ON ekkolifnr EQ lfa1lifnr
    INNER JOIN t001w AS t001w
    ON ekpowerks EQ t001wwerks
    INNER JOIN makt AS makt
    ON ekpomatnr EQ MAKTmatnr
    WHERE ekko~ebeln IN s_ebeln.
    This is the complete SELECT. BUT! The performance will be much better if you take out T001W and MAKT from the INNER JOIN. Do select on these tables in separate steps and merge the internal tables afterwards.
    hope this helps
    ec

  • Inner join on four tables

    hi all,
    i am facing the problem with the inner join in the select query for 4 tables.
    can i use the inner join for tables in SAP 6.0 version,
    it is going to dump.
    here is my code
    SELECT DISTINCT apernr abegda aendda awagetype aamount acurrency
            altrctry brufnm banred bvorna bnachn cgroupcode d~vdsk1
    FROM pa9011 AS a INNER JOIN pa0002 AS b ON bpernr = apernr
                      INNER JOIN pa9013 AS c ON cpernr = bpernr
                      inner join pa0001 as d on dpernr = cpernr
                      INTO CORRESPONDING FIELDS OF TABLE it_bonus
    WHERE a~pernr IN s_pernr AND
           a~begda IN s_date AND
           a~subty EQ s_subty AND
           a~wagetype EQ wa_perbonus AND
           a~ltrctry = gc_ind AND
           a~amount > 0 AND
           b~endda = '99991231' AND
           c~groupcode IN s_loc AND
           c~endda = '99991231' and
           d~endda = '99991231'
        ORDER BY a~pernr.

    hi this is the dump ,
    In a SELECT access, the read file could not be placed in the target
    field provided.
    Either the conversion is not supported for the type of the target field,
    the target field is too small to include the value, or the data does not
    have the format required for the target field.

  • Join on two tables using "LIKE"

    Hi all,
    I need make join on two tables (QMEL and STXL) using keys for connection:
    - field for join of first table is (QMEL-QMNUM - Notif. number - Char 12)
    - field for join of second table is  (STXL-TDNAME - Char 70)
    If it is connection based on EQ, I think, it's no problem but I need to connect it on base of 'LIKE'.
    Example:
    QMEL-QMNUM = '100100698075'
    I would like get all rows from STXL which contain or even better start with notif. number.
    Examples I would like connect with QMEL-QMNUM:
    STXL-TDNAME = '100100698075'
    STXL-TDNAME = '1001006980750001'
    STXL-TDNAME = '10010069807500010001'
    STXL-TDNAME = '10010069807500010002'
    etc..
    Am I able to manage that with select which join these two tables this way?
    Thanks for any solution
    Vaclav Hosek.

    Hi,
    Write 2 separate selects for this.
    select * from QMEL
    where......
    if sy-subrc = 0.
    loop at i_qmel into wa.
    r_tdname-option = 'CP'.
    r_tdname-sign = 'I'
    concatenate wa-qnum '*' into r_tdname-low.
    append r_tdname.
    endloop.
    select *
    from STL
    where tdname in r_tdname.
    endif.

  • Joins for INV tables  R12

    Hi,
    Could you provide joins for below tables:
    mtl_system_items_b
    mtl_kanban_cards
    mtl_onhand_quantities_detail
    MTL_SECONDARY_INVENTORIES
    MTL_ITEM_CATEGORIES
    MTL_CATEGORY_SETS_TL
    MTL_CATEGORIES_B
    Thanks

    Yes it is kind of limitation in obiee. But there are some solutions which might deviate from best practices.
    Sol 1. Snowflake the dimensions in Business Model. Rather than merging both of them into single logical table, separate them into two different logical tables.
    Sol 2. For the logical table , have two LTSs. First LTS will have both tables and all columns mapped to both tables. Second LTS will have only main table, Columns belong to that table only mapped. In this way when you selected columns related to first source system will use second LTS which has only only one table.
    - Madan Thota

  • HOW DEFINE INNER JIONS FOR MULTIPLE TABLE-FIELDS

    HI I  HAVE THE IMMEDIATE ISSUE TO RESOLVE...
    data: begin of it_jtab occurs 0,
    gsber like tgsb-gsber,
    gjahr like coss-gjahr,
    kostl like csks-kostl,
    posid like prps-posid,
    plfaz like proj-plfaz,
    plsez like proj-plsez,
    estat like tj30t-estat,
    perbl like coss-perbl,
    wkgbtr like coep-wkgbtr,
    end of it_jtab.
    HOW CAN I DO INNER JOIN FOR THE GIVEN TABLE??
    AM CURENTLY ON 4.0 VERSION HENCE HELP ME KNOW TO WORK ON JOINS ONLY.........

    Hi,
    Check this prog,
    Inner joins using 3 tables 
    Try this :-
    SELECT stpostlnr stpoidnrk mastmatnr maramtart stpo~menge 
    INTO CORRESPONDING FIELDS OF TABLE zmat1 FROM mast 
    JOIN stpo ON stpostlnr = maststlnr 
    JOIN mara ON maramatnr = mastmatnr 
    WHERE stpostlty = 'M' "AND stpoidnrk IN s_matnr 
    AND mast~werks = 1000. 
    Here s_matnr is a select-options on the selection-screen. 
    Or this. 
    Code: 
         Select single VbrkBukrs VbrkKunrg    Vbrk~Vbeln 
                       VbrkFkdat VbrkBstnk_Vf Vbrk~Zterm 
                       Tvzbt~Vtext 
                       VbakVbeln VbakBstdk 
                       LikpVbeln Likplfdat    Likp~Lfuhr 
           into w_vbrk 
           from vbrk 
          inner join       Tvzbt on TvzbtZterm        = VbrkZterm      and 
                                    Tvzbt~Spras        = sy-langu 
          Inner join       Vbfa  as SalesLnk 
                                 on SalesLnk~vbeln     = pu_vbeln        and 
                                    SalesLnk~vbtyp_v   = c_order 
                inner join Vbak  on VbakVbeln           = SalesLnkVbelv
          Inner join       Vbfa  as DeliveryLnk 
                                 on DeliveryLnk~vbeln   = pu_vbeln       and 
                                    DeliveryLnk~vbtyp_v = c_Delivery 
                inner join Likp  on LikpVbeln          = DeliveryLnkVbelv 
          where vbrk~vbeln = pu_Vbeln. 
    This code locates sales, delivery and payment terms info from a billing document number. 
    or
    Here, this one also works fine :
    select zfpcdcadivi zfpcdproforma zfpcdfactura zfpcdaniofactura 
    zfpcdmontousd zfpcdmontoap zfpcdebeln zfpcdinco1 
    zfpcdlifnr lfa1name1 zcdvsstatus zfpcdconint 
    into it_lista 
    from zfpcd inner join zcdvs 
    on zfpcdebeln = zcdvsebeln 
    and zfpcdproforma = zcdvsproforma 
    and zfpcdlifnr = zcdvslifnr 
    inner join lfa1 
    on zfpcdlifnr = lfa1lifnr 
    where zcdvs~status = '04'. 
    Regards,
    Arunsri

  • Prcedure to joining of two tables and pls explore the primary & foriegn key

    Dear All,
    Am new to this forum looking forward to have some discussions and guidance reg ABAP.
    <b>My query is</b>
    what is the prcedure to joining of two tables and pls explore the primary & foriegn key relationships.
    Your kind help is required in this query .
    Thanks n regards
    Carol P

    Hi Carol,
    Joining two tables fetch data from tables that has relevent entry based on the keys. like LIKP and LIPS these are delivery tables. if the business requirement is fetching delivery data that are exists in both two tables. here LIKP will conatins a single entry against a condition and LIPS may contains several entry because one delivery may has multiple line items. so, fetch the data joining the two tables on vbeln that is delivrey number. this is used to increase the performance of the program except for all entries.
    Foreign key is poiting twowards primary key; it may be 1:1 , 1:many and many:many. if field1 of table a is pointing towards field1 of table b. then based on these condition at the time of entry SAP will check how many entry can be entred in field1 of table a.
    regards
    Krishnendu

  • Join this two table HELP

    Hi to all.. i have this two table , the problem is i dunno how to join this two table into one, becoz in the forms i have two button "BUTTON A IS FOR TABLE A WHICH IS THE EMPLOYEE.. AND BUTTON B IS FOR ADMIN... WHAT I WANT IS TO MAKE THIS TWO BUTTON INTO ONE BUTTON.. i;m using form6i and run in client server..
    Guys any one here know plz help how to do this..
    TABLE 1
    BEGIN
    iF :username IS NULL THEN
    MESSAGE ('Please enter Username ');
    MESSAGE ('Please enter Username ');
    GO_ITEM('username');
    RAISE FORM_TRIGGER_FAILURE;
    end if;
    IF :PASSNAME1 IS NULL THEN
    MESSAGE('Please enter password.');
    MESSAGE('Please enter password.');
    GO_ITEM('PASSNAME1');
    RAISE FORM_TRIGGER_FAILURE;
    end if;
    select username,passname
    into :pass.username,:pass.passname1
    from Employees
    where :pass.username=username
    and :pass.passname1=passname;
    Message('Access Granted');
    Message('Access Granted');
    go_block('maina');
    hide_view('pass1');
    exception
    when no_Data_found then
    set_alert_Property('wrong',Alert_Message_text,'Invalid Password');
    if show_alert('wrong')=alert_button1 then
              go_item('PASSNAME1');
              :passname1:=null;
              end if;
    end;
    TABLE 2
    BEGIN
    iF :username IS NULL THEN
    MESSAGE ('Please enter Username ');
    MESSAGE ('Please enter Username ');
    GO_ITEM('username');
    RAISE FORM_TRIGGER_FAILURE;
    end if;
    IF :PASSNAME1 IS NULL THEN
    MESSAGE('Please enter password.');
    MESSAGE('Please enter password.');
    GO_ITEM('PASSNAME1');
    RAISE FORM_TRIGGER_FAILURE;
    end if;
    select username,passname
    into :pass.username,:pass.passname1
    from Admin1
    where :pass.username=username
    and :pass.passname1=passname;
    Message('Access Granted');
    Message('Access Granted');
    go_block('maina');
    hide_view('pass1');
    exception
    when no_Data_found then
    set_alert_Property('wrong',Alert_Message_text,'Invalid Password');
    if show_alert('wrong')=alert_button1 then
              go_item('PASSNAME1');
              :passname1:=null;
              end if;
    end;

    like i told you before in this posting How to join this two tables
    use a union
    select username,passname
    into :pass.username,:pass.passname1
    from Employees
    where :pass.username=username
    and :pass.passname1=passname
    union
    select username,passname
    into :pass.username,:pass.passname1
    from Admin1
    where :pass.username=username
    and :pass.passname1=passname;

  • Subject: How to do join between two tables using something like SE16

    SE16, SE11 provide form based interface query information from a single table. Is there a way to do join between two tables without creating an infoset erc? I am looking for something similar to sql join but in SAP BI 7.0
    Thanks.

    Hi
    Pls look into below links. Hope this helps you.
    1. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45bf455611d189710000e8322d00/content.htm
    2. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45a5455611d189710000e8322d00/content.htm
    Regards
    Sirigiri

  • Sql join on two tables where column like another column

    hi all,
    been trying to get the results from a join between two tables where one column is like another one.
    table1 (nameA) examples: black2, green1
    table2 (nameB) example: black2.location.uk.com, green1.location.uk.com
    so for example I want to match all those in table1 with black2 to the column in table2 that begins with black2 and so on if you see what im trying to get at!
    my sql so far:
    select * from  schema.table1 a
    join schema.table2 b
    on a.nameA like concat('%', b.nameB, '%'); but it errors:
    ORA-00909: invalid number of arguments
    00909. 00000 - "invalid number of arguments"
    Any help or advice would be greatly appreciated, thankyou!

    Either of these should do it...
    select * from  schema.table1 a
    join schema.table2 b on a.nameA like '%'||b.nameB||'%';or
    select * from  schema.table1 a
    join schema.table2 b on instr(b.nameB,a.nameA) > 0

Maybe you are looking for

  • Frequent crashes with 12.0.0.77

    I decided to check to see if flash player was updated today and happily I saw that there was a new version. Since the update previous to this one I was very pleased with the fixes that have come out however I notice one rather irritating feature abou

  • Weekly report on invoiced shipments

    Hello,   we have customers and was able to submit a weekly report on invoiced shipments for them in one of the middleware.  can I get the same information in SAP?   report generated from middleware includes the below data bill_to_id                 b

  • Tools Palette Dropdown Issue

    None of the dropdowns on Tools Palette work ex: Type Tool, Pen Tool, Pencil Tool,etc. I cannot get the dropdowns for any of these to appear. I've tried uninstalling and reinstalling the entire suite - reinstalling each separately - no luck. I'm sure

  • Should we index table vbfa if vbeln and vbelv is already key field.

    Dear All, actually I am passing billing document into vbfa and want vbelv  for faster access data from data base into internal table  should we index table vbfa if vbeln and vbelv is already key field. Regards chandrashekar

  • Where is Rosetta?

    I have just done a clean reinstall of Snow Leopard and now want to reinstall my old Power PC Epson 1200 Perfection. As far as I understand I need Rosetta installed for it to work. I have loaded Rosetta from the SL disc but wonder how I can be sure it