Perculiar results of finding max sum of an array

hi.
I am doing an assigment of the time complexity of finding maxsum of an array. However, the time that i got for N log N algorithm is faster than the time of a N algorithm. Is there any reason with that? The same code is run on another machine but do that have the funny result. I am using a Microsoft Windows XP Professional, Laptop @ 1.4GHz of processor, Intel� 855GM chipset, 512MB DDR
Further to that, what is a time complexity formula? Do we follow a certain standard to getting the formula?

And what does that have to do with the javadoc tool, which this forum is for?

Similar Messages

  • Need help finding the sum of an array list

    I'm making a mock up of iTunes, I suppose, for class. My only issue is that I can't figure out how to add all the durations of each sound file when it's stated in the array.
    I've put the part I'm having trouble with in bold, it is located in the Jpod class. We're using a program called BlueJ for coding, which is why the commenting is slightly odd.
    import java.applet.*;
    import java.io.*;
    import java.net.*;
    public class SoundPlayer
        public SoundPlayer(String fileName, int duration)
            AudioClip testClip;
            URL testUrl;
            System.out.println("Playing " + fileName);
            try{
                testUrl=new URL("file:" + new File(".").getCanonicalPath() + "/" + fileName);
                testClip=Applet.newAudioClip(testUrl);
                testClip.play();
                Thread.sleep(duration*1000);
                testClip.stop();
            }catch(Exception e){ System.out.println(e.toString()); }
    public class Sound
        private String author;
        private String fileName;
        private int duration;
         * Constructor for objects of class Sound
        public Sound(String newAuthor, String newFileName, int newDuration)
            // initialise instance variables
            author = newAuthor;
            fileName = newFileName;
            duration = newDuration;
         * Returns the duration of the sound file
         * @return     duration of the sound file
        public int getDuration()
            // returns duration
            return duration;
         * Returns the author of the sound file
         * @return     author of the sound file
        public String getAuthor()
            //returns author
            return author;
         * Prints the author, filename, and duration
        public void printSound()
            System.out.println("Author: " + author + " File name: " + fileName + " Duration: " + duration);
         * Plays the sound
         * @return     sound file
        public void playSound()
            new SoundPlayer("Lab4.wav",3);
    import java.util.ArrayList;
    import java.util.Iterator;
    public class Jpod
        // instance variables - replace the example below with your own
        private ArrayList<Sound> playlists;
         * Constructor for objects of class Jpod
        public Jpod()
            playlists = new ArrayList<Sound>();
         * Adds a sound to the playlist
         * @param  sound   of type Sound
        public void addSound(Sound sound)
            // inserts the sound into the playlist
            playlists.add(sound);
         * Adds 3 sounds to a playlist
        public void createPlayList()
            Sound s;
            s = new Sound("Microsoft", "Lab4.wav", 2);
            addSound(s);
            s = new Sound("Dr. Evil", "DrEvil.wav", 4);
            addSound(s);
            s = new Sound("Arnold Schwarzenegger", "Terminator.wav", 2);
            addSound(s);
         * Remove desired sound object
         * @param indexNumber The number of the sound object to be removed
        public void removeSound(int indexNumber)
            if(indexNumber < 0){
                //Not a valid index number - do nothing
            else if(indexNumber < playlists.size()){
                //Valid indexNumber
                playlists.remove(indexNumber);
            else {
                //Not a valid index number - do nothing
         * Show the sound object
         * @param indexNumber The number of the sound object to be shown
        public void getSound(int indexNumber)
            if(indexNumber < 0){
                //Not a valid index number - do nothing
            else if(indexNumber < playlists.size()){
                //Valid indexNumber
                System.out.println(playlists.get(indexNumber));
            else {
                //Not a valid index number - do nothing
         * @return The number of sounds in the playlist
        public int getSize()
            return playlists.size();
         * List all sounds in the playlist
        public void indexPrintList()
            for(Sound playlist : playlists) {
                playlist.printSound();
         * Lists all sounds in the playlist using an iterator
        public void iteratorPrintList()
            Iterator<Sound> iter = playlists.iterator();
            while(iter.hasNext()) {
                ((Sound)iter.next()).printSound();
         * Gives the total duration of all sounds in the playlist
        *public void totalDuration()*
            *//currently prints all durations - still working on sum*
            *for(Sound playlist : playlists) {*
                *System.out.println(playlist.getDuration());*
         * Plays through all the sounds in the playlist
         * Extra Credit
        public void indexPlayList()
            for(Sound playlist : playlists) {
                playlist.playSound();
         * Plays through all sounds in the playlist using an iterator
         * Extra Credit
        public void iteratorPlayList()
            Iterator<Sound> iter = playlists.iterator();
            while(iter.hasNext()) {
                ((Sound)iter.next()).playSound();
    }

    not sure if I'm missing something here, but this could possibly be solved by initializing a variable to 0 before the for loop, and then adding each duration to this variable as you loop. This seems too trivial a solution though. Again, I may be missing something here.
    something simple like:
    public void calcSum()
        int i = 0;
        for(Fubar foo: fooList) {
            i += foo.getLength();
        System.out.println("Sum = " + i);
    }Edited by: petes1234 on Oct 23, 2007 9:09 AM

  • Where do I find the SUM & MAX functions under update rule, TYPE: FORMULA

    Hi,
    If I am setting up an update routine
    TYPE: FORMULA
    where do I find the function SUM ?
    I need to take the sum of a particular key figure under certain condition with the statement:
    IF( <condition>, <result when true>, <result when false> )
    i.e.
    IF( field1 > field2, Sum of Field3, Sum of Field3 )
    I canu2019t seem to find the Sum function. I found +, -, / etc under Basic Functions. Even under all u201CAll functionsu201D, I only see u201Csummarizeu201D but not sum.
    --Also where do I find the MAX and MIN functions if I want to use them in FORMULAS?
    Thanks

    Hi......
    Its better you go for calculated keyfigure
    Check this link :
    http://help.sap.com/saphelp_nw04/helpdata/en/6f/56853c08c7aa11e10000000a11405a/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/EN/13/e072abaddb574284d22361f0b824bf/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/72f4a790-0201-0010-5b89-a42a32223ffc
    It may help you......
    Regards,
    Debjani......
    Edited by: Debjani  Mukherjee on Sep 28, 2008 6:17 AM
    Edited by: Debjani  Mukherjee on Sep 28, 2008 6:23 AM

  • How to find the sum of a column

    I need to find the sum of a column and use it in a different column. The following is the example.
    Column names: Feedback(Good, Avg, Poor), Count(no of good, no of avg, no of poor) and %age(Feedback/sum(feedback))
    I want to find the sum in Java class and also calculate the last column in java class.
    Please tell me some way to do it.

    oh.. ok ..thanks for letting me know.. i will formulate the question in a proper way:
    This is what my UI should look like:
    Rating Count Percent
    Excellent 2 20
    Good 6 60
    Poor 1 10
    Bad 1 10
    Now i have the following columns in the data base:
    Meaning and feedback_rating.
    So the following SQL Query:
    SELECT hrl.meaning rating,
    sum(decode(bcpi.feedback_rating, null, 0, 1)) counted
    from cmp_cwb_person_info bcpi ,
    hr_lookups hrl
    group by hrl.meaning
    will give me the result as
    rating counted
    Excellent 2
    Good 6
    Poor 1
    Bad 1
    Now I want a third column as percentage : Earlier we were doing this calculation in the sql query itself, so the query was like
    SELECT hrl.meaning rating,
    sum(decode(bcpi.feedback_rating, null, 0, 1)) counted,
    sum(decode(bcpi.feedback_rating, null, 0, 1))/(max (select count (*) from cmp_cwb_person_info bcpi ,
    hr_lookups hrl )) percent
    from cmp_cwb_person_info bcpi ,
    hr_lookups hrl
    group by hrl.meaning
    Hence the third column (percent) was calculated in the sql query itself.
    But now i feel that the performance of the query could be improved if we get the first two columns from the database and the calculate the third column programatically in the java code.
    So this is what I want to know. How can i do that?

  • Finding MAX/MIN value

    Hi!
    There are different records in PSA.
    When I load to DSO I need only max value for key figure.
    For example, data in PSA:
    Char| KF
    1| 2
    1| 5
    1| 3
    2| 1
    If I use Overwrite then result is:
    1| 3
    2| 1
    If I use Sum then result is:
    1| 10
    2| 1
    But I need followed reult:
    1| 5
    2| 1
    How can I find max value for KF without using FM or Programs?

    Hi,
    You can do this in a Start routine.
    Sort the source package and copy the records with the max value to another internal table which has the same structure as your source package.
    In the end of the routine, over write records in source package with the records in the internal table.
    THis will help.
    - Jaimin

  • How to find max based on 2 columns.

    Hi I have a table where I have two numeric fields (date and time) )(thouse field are not date time format but numeric)
    Column A represents date and column B represent time.
    How would I find max value of column A and with results for A find Max for B.
    example
    A - - - - - - - - - -B
    101010 - - - - - 202020
    101011 - - - - - 202021
    101012 - - - - - 202021
    101010 - - - - - 202022
    101012 - - - - - 202020
    What I looking for is
    A - - - - - - - - - - B
    101012 - - - - - 202021
    Thanks

    You can try one of the following...
    sql> select * from temp;
             A          B
        101010     202020
        101011     202021
        101012     202021
        101010     202022
        101012     202020
      1  select a,b from (
      2     select a,
      3            b,
      4            rank () over (order by a desc, b desc) rnk
      5       from temp
      6* ) where rnk = 1
    sql> /
             A          B
        101012     202021
      1  select a,b from (
      2    select a,b from temp
      3       order by a desc, b desc
      4* ) where rownum = 1
    sql> /
             A          B
        101012     202021Please try to provide create table statements and insert data scripts instead of "select * from table".
    It helps creating your case easier.

  • Thread use to find max and min in an array of objects??

    Hello everyone,
    I need to find the min and max int value in a array of Objects.
    This has to be done using threads--like divide the entire array into 10 or so blocks and find the local min and max in each block., Each block is run on a thread and finally comparing them to find the global max and min.How should I do this? I am new to Java programming and in particular to threads.
    Thanks for your time and patience in answering this newbie question.
    JP

    Hi,
    if i understand your problem, you have a big array with a lot of int values and you need to create a few arrays with a part of the big one in each, next each in a thread find the max and the min, next return the max and the min of each thread and compare these max and min to obtain the globals max and min?
    In that case you can create a class in which is your big array. you create a second class implementing Runnable, in its creator you put the instance of the
    first class and 2 int which are the beginning and the ending index. in this class add a method run in this method you create a loop to compare the current value to the max and min values, and you replace if you need to do. In the first class you put the main where you create a few instance of the second class in a thread :
         private Thread threadName = new Thread(new SecondClass(this, start, end));
    Next you start all these thread:
    threadName.start();
    At the end of the run method of the second class you have to write your result in the max and min fields of the first class(int type, you have to create it)
    Write it only if it's necessary (if the current max is > than the already existing max).
    I think it's complete!
    Sorry if it's not really easy to understand, I'm french, but you can answer if you have more questions.
    S�bastien

  • Query Builder results seem to max out at 500 lines.  How to change?

    Hi all,
    Some of out Application Express users are using the Query Builder tool for ad-hoc reporting. The idea is to run the SQL to extract the data, then download to MS Excel. The Query Builder results seem to max out at 500 lines. I want to increase that value. I searched all Application Express forums for 'query builder output max 500' and then 'query builder output' and did not find the answer.
    How do I change the 500 line limit in Query Builder results?
    Thanks!
    Application Express 3.1.2.00.02
    Oracle 10g
    Standard PDF printing (not BI Publisher)

    Bryan,
    Here is a link to an HTML-DB studio application, that is a QBE "replacement" for the query tool in APEX development..
    http://htmldb.oracle.com/pls/otn/f?p=18326:7:1387557504245687::::P7_ID:1222
    It is for an older version of APEX, but you should be able to make it work for your needs..
    Thank you,
    Tony Miller
    Webster, TX

  • Max, sum function

    I would like to get this result:
    NAZWAWYDZIALU NAZWISKO
    Organizacji i Zarządzania | Moskowitz
    Elektrotechniki Informatyki | Crocitto
    Mechaniczny | Walter
    Inżynierii Procesowej | Mierzwa
    Fizyki Technicznej | Olvsade
    August displayed the names of employees who have the most papers.
    I wrote the following query:
    SELECT w.NazwaWydzialu, p.nazwisko
    FROM wydzialy w,
              pracownicy p ,
              referatyPracownikow rp,
              referaty r,
              konferencje k
    WHERE rp.idreferat = r.idReferatu and
                   p.idPracownika = rp.idPracownika and
                   r.idKonferencji = k.idKonferencji
    HAVING count( * *)* = ( SELECT MAX ( sum (r.idReferatu))
                                  FROM wydzialy w,
                                       pracownicy p,
                                       referatyPracownikow rp,
                                       referaty r,
                                       konferencje k
                                  WHERE rp.idreferat = r.idReferatu and
                                            p.idPracownika = rp.idPracownika and
                                            r.idKonferencji = k.idKonferencji      
                                  GROUP BY r.idReferatu)
         GROUP BY w.NazwaWydzialu, p.nazwisko ;
    returns 0 rows :(
    Please kindly information, whether well-written query.
    Tables:
    CREATE TABLE publikacje (
         idPublikacji number(4) CONSTRAINT kl_glowny_pub PRIMARY KEY ,
         tytulPublikacji varchar(30),
         nazwaWydawnictwa varchar(30),
         dataPublikacji date
    CREATE TABLE konferencje (
         idKonferencji number(4) CONSTRAINT kl_glowny_konf PRIMARY KEY ,
         NazwaKonferencji varchar(30),
         lokalizacja varchar(30),
         dataPoczatkowa date,
         dataZakonczenia date
    CREATE TABLE przedmioty (
         idPrzedmiotu number(4) CONSTRAINT kl_glowny_przed PRIMARY KEY ,
         nazwaPrzedmiotu varchar(30)
    CREATE TABLE FormyPrzedmiotow (
         idFormyPrzed number(4) CONSTRAINT kl_glowny_formyPrzed PRIMARY KEY,
         idPrzedmiotu CONSTRAINT kl_obcy_przed REFERENCES przedmioty(idPrzedmiotu),
         forma varchar(30),
         semestr number(1),
         rokAkademicki date
    CREATE TABLE uczelnie (
         iduczelni number(4) CONSTRAINT kl_glowny_ucze PRIMARY KEY ,
         NazwaUczelni varchar(30),
         adres varchar(30),
         kodpocztowy varchar(6),
         miasto varchar(30),     
         NrTelefonu number(10),
         NIP_ucz     number(10)
    CREATE TABLE wydzialy (
         idWydzialu number(4) CONSTRAINT kl_glowny_wydz PRIMARY KEY ,
         NazwaWydzialu varchar(30),
         Iduczelni CONSTRAINT kl_obcy_ucz REFERENCES uczelnie(iduczelni)
    CREATE TABLE katedry (
         idkatedry number(4) CONSTRAINT kl_glowny_kated PRIMARY KEY ,
         Nazwakatedry varchar(30),
         IdWydzialu CONSTRAINT kl_obcy_wydz REFERENCES wydzialy(idWydzialu)     
    CREATE TABLE pracownicy (
         idPracownika number(4) CONSTRAINT kl_glowny_prac PRIMARY KEY ,
         nazwisko varchar(30),
         imie varchar(30),
         tytul_naukowy varchar(30),
         adres varchar(30),
         kodPoczatkowy varchar(6),
         miasto varchar(30),
         telefonDomowy number(10),
         dataUrodzenia date,
         ID_katedry CONSTRAINT kl_obcy_kated REFERENCES katedry(idkatedry)
    CREATE TABLE referaty (
         idReferatu number(4) CONSTRAINT kl_glowny_ref PRIMARY KEY ,
         tytulReferatu varchar(30),
         dataReferatu date,
         idKonferencji CONSTRAINT kl_obcy_konf REFERENCES konferencje(idKonferencji)
    CREATE TABLE referatyPracownikow (
         idreferat CONSTRAINT kl_obcy_ref REFERENCES referaty(idReferatu),
         idPracownika CONSTRAINT kl_obcy_prac REFERENCES pracownicy(idPracownika)
    CREATE TABLE publikacjePracownikow (
         idPracownika CONSTRAINT kl_obcy_prac2 REFERENCES pracownicy(idPracownika),
         idPublikacji CONSTRAINT kl_obcy_pub REFERENCES publikacje(idPublikacji)
    CREATE TABLE przedmiotyProwadzone (
         idFormyPrzed CONSTRAINT kl_obcy_formyPrzed2 REFERENCES FormyPrzedmiotow(idFormyPrzed),
         idPracownika CONSTRAINT kl_obcy_prac3 REFERENCES pracownicy(idPracownika),
         LiczbaGodz number(10)
    );

    INSERT INTO publikacje VALUES (1, 'tytulPublikacji 1', 'nazwaWydawnictwa 1',TO_DATE('29-APR-2011 20:17:26','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO publikacje VALUES (2, 'tytulPublikacji 2', 'nazwaWydawnictwa 2',TO_DATE('25-MAR-2012 22:15:06','DD-MON-YYYY HH24:MI:SS'));
    INSERT INTO publikacje VALUES (3, 'tytulPublikacji 3', 'nazwaWydawnictwa 3',TO_DATE('11-JAN-2008 09:14:08','DD-MON-YYYY HH24:MI:SS'));
    INSERT INTO publikacje VALUES (4, 'tytulPublikacji 4', 'nazwaWydawnictwa 4',TO_DATE('09-FEB-2009 10:14:13','DD-MON-YYYY HH24:MI:SS'));
    INSERT INTO publikacje VALUES (5, 'tytulPublikacji 5', 'nazwaWydawnictwa 5',TO_DATE('23-MAY-2010 17:16:23','DD-MON-YYYY HH24:MI:SS'));
    INSERT INTO konferencje VALUES (1, 'konferencje 1', 'Warszawa' ,TO_DATE('29-APR-2011 09:17:26','DD-MON-YYYY HH24:MI:SS') ,TO_DATE('29-APR-2011 20:17:26','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO konferencje VALUES (2, 'konferencje 2', 'Warszawa' ,TO_DATE('25-MAR-2012 10:15:06','DD-MON-YYYY HH24:MI:SS') ,TO_DATE('29-APR-2011 17:17:26','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO konferencje VALUES (3, 'konferencje 3', 'Warszawa' ,TO_DATE('11-JAN-2011 09:14:08','DD-MON-YYYY HH24:MI:SS') ,TO_DATE('11-JAN-2011 18:14:08','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO konferencje VALUES (4, 'konferencje 4', 'Warszawa' ,TO_DATE('09-FEB-2012 10:14:13','DD-MON-YYYY HH24:MI:SS') ,TO_DATE('09-FEB-2012 16:14:13','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO konferencje VALUES (5, 'konferencje 5', 'Warszawa' ,TO_DATE('23-MAY-2012 10:10:23','DD-MON-YYYY HH24:MI:SS') ,TO_DATE('23-MAY-2012 17:16:23','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO przedmioty VALUES (1, 'Sztuczna inteligencja' );
    INSERT INTO przedmioty VALUES (2, 'Bazy danych' );
    INSERT INTO przedmioty VALUES (3, 'Inzynieria oprogramowania' );
    INSERT INTO przedmioty VALUES (4, 'Matematyka' );
    INSERT INTO przedmioty VALUES (5, 'Algorytmy i struktury danych' );
    INSERT INTO FormyPrzedmiotow VALUES (1, 1, 'forma 1', 1, TO_DATE('16-MAY-2010 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (2, 1, 'forma 2', 2, TO_DATE('16-JAN-2012 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (3, 2, 'forma 3', 3, TO_DATE('16-APR-2012 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (4, 2, 'forma 4', 4, TO_DATE('16-APR-2011 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (5, 3, 'forma 5', 5, TO_DATE('16-JUN-2012 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (6, 4, 'forma 6', 6, TO_DATE('16-FEB-2011 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (7, 5, 'forma 7', 7, TO_DATE('16-MAY-2012 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (8, 3, 'forma 8', 1, TO_DATE('16-APR-2012 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (9, 1, 'forma 9', 3, TO_DATE('16-JAN-2012 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO FormyPrzedmiotow VALUES (10, 2, 'forma 10',2, TO_DATE('16-FEB-2012 09:00:00','DD-MON-YYYY HH24:MI:SS') );
    INSERT INTO uczelnie VALUES (1, 'Politechnika Warszawska' , 'ul. Matuszewskiego 82; ','06-300', 'Przasnysz', 7582313 , 9084546646);
    INSERT INTO uczelnie VALUES (2, 'Politechnika Wroclawska' , 'ul. Polna 7/6; ','09-221', 'Poznan', 7562213 , 9014546645);
    INSERT INTO uczelnie VALUES (3, 'Politechnika Gdanska' , 'ul. Figarskiego 6; ','08-675', 'Kielce', 7362316 , 2084244444);
    INSERT INTO uczelnie VALUES (4, 'Politechnika Slaska' , 'ul. Dluga 51; ','08-675', 'Poznan', 7362217 , 1222521111);
    INSERT INTO uczelnie VALUES (5, 'Politechnika Łódzka' , 'ul. Macieja 31; ','08-675', 'Poznan', 7568288 , 1014546778);
    INSERT INTO wydzialy VALUES (1,'Organizacji i Zarządzania', 2 );
    INSERT INTO wydzialy VALUES (2,'Elektrotechniki Informatyki', 1 );
    INSERT INTO wydzialy VALUES (3,'Mechaniczny' , 5);
    INSERT INTO wydzialy VALUES (4,'Inzynierii Procesowej', 1 );
    INSERT INTO wydzialy VALUES (5,'Fizyki Technicznej' ,3);
    INSERT INTO katedry VALUES (1, 'Zarządzania',2 );
    INSERT INTO katedry VALUES (2, 'Elektrotechniki',1 );
    INSERT INTO katedry VALUES (3, 'Mechaniczna' ,5);
    INSERT INTO katedry VALUES (4, 'Inzynierii',1 );
    INSERT INTO katedry VALUES (5, 'Fizyki' ,3);
    INSERT INTO pracownicy VALUES (1,'Crocitto', 'Fred' ,'doktor', 'ul. Polna 7/6; ','09-221', 'Poznan', 5352217 , TO_DATE('16-MAY-1990 09:00:00','DD-MON-YYYY HH24:MI:SS'), 1);
    INSERT INTO pracownicy VALUES (2,'Landry', 'Laetia.' ,'doktor', 'ul. Dluga 51; ','08-675', 'Poznan', 2252259 , TO_DATE('09-FEB-1970 05:20:08','DD-MON-YYYY HH24:MI:SS'), 2);
    INSERT INTO pracownicy VALUES (3,'Enison', 'Laetia' ,'doktor', 'ul. Macieja 31; ','08-675', 'Poznan', 8262215 , TO_DATE('19-JAN-1970 10:00:09','DD-MON-YYYY HH24:MI:SS'), 3);
    INSERT INTO pracownicy VALUES (4,'Moskowitz','Angel' ,'magister', 'ul. Figarskiego 6; ','08-675', 'Kielce', 7362218 , TO_DATE('17-FEB-1970 03:10:10','DD-MON-YYYY HH24:MI:SS'), 5);
    INSERT INTO pracownicy VALUES (5,'Olvsade', 'Judith' ,'profesor', 'ul. Figarskiego 6; ','08-675', 'Warszawa', 6362187 , TO_DATE('11-MAR-1962 12:08:11','DD-MON-YYYY HH24:MI:SS'), 4);
    INSERT INTO pracownicy VALUES (6,'Mierzwa', 'Catherine','profesor', 'ul. Dluga 01; ','08-685', 'Warszawa', 7462115 , TO_DATE('14-JAN-1970 13:00:01','DD-MON-YYYY HH24:MI:SS'), 2);
    INSERT INTO pracownicy VALUES (7,'Sethi', 'Judy' ,'doktor habilitowany', 'ul. Polna 6; ','09-281', 'Poznan',7462317, TO_DATE('23-MAR-1979 15:06:23','DD-MON-YYYY HH24:MI:SS'), 5);
    INSERT INTO pracownicy VALUES (8,'Walter', 'Larry' ,'doktor habilitowany', 'ul. Macieja 31; ','08-675', 'Poznan',7345218, TO_DATE('20-FEB-1959 01:04:07','DD-MON-YYYY HH24:MI:SS'), 1);
    INSERT INTO referaty VALUES (1, 'baza Acces',TO_DATE('13-MAR-2012 10:05:06','DD-MON-YYYY HH24:MI:SS'),2 );
    INSERT INTO referaty VALUES (2, 'Eksploracja danych',TO_DATE('09-MAY-2012 12:00:06','DD-MON-YYYY HH24:MI:SS'),1 );
    INSERT INTO referaty VALUES (3, 'Podstawy rysunku technicznego' ,TO_DATE('05-FEB-2012 14:10:06','DD-MON-YYYY HH24:MI:SS'),5);
    INSERT INTO referaty VALUES (4, 'Animacja i wideo',TO_DATE('27-FEB-2012 12:10:06','DD-MON-YYYY HH24:MI:SS'),1 );
    INSERT INTO referaty VALUES (5, 'Szkolenie BHP' ,TO_DATE('21-MAY-2012 16:10:06','DD-MON-YYYY HH24:MI:SS'),3);
    INSERT INTO referatyPracownikow VALUES (1, 2 );
    INSERT INTO referatyPracownikow VALUES (2, 1 );
    INSERT INTO referatyPracownikow VALUES (4 , 6 );
    INSERT INTO referatyPracownikow VALUES (4, 1 );
    INSERT INTO referatyPracownikow VALUES (5, 3 );
    INSERT INTO publikacjePracownikow VALUES (1, 1 );
    INSERT INTO publikacjePracownikow VALUES (2, 3 );
    INSERT INTO publikacjePracownikow VALUES (3, 5 );
    INSERT INTO publikacjePracownikow VALUES (4, 1 );
    INSERT INTO publikacjePracownikow VALUES (5, 4 );
    INSERT INTO przedmiotyProwadzone VALUES (1, 1 ,160 );
    INSERT INTO przedmiotyProwadzone VALUES (2, 3 ,120 );
    INSERT INTO przedmiotyProwadzone VALUES (3, 5 ,140 );
    INSERT INTO przedmiotyProwadzone VALUES (4, 1 ,120 );
    INSERT INTO przedmiotyProwadzone VALUES (5, 4 ,100 );

  • Query to find max on UNION

    Hi ALL,
    I need to find max date from a union result. I tried to use bellow query,
    select max(last_processed) from
    (select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS_ORGS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS_NOTES UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_SUBS_CONTENT_LKUP UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_SUBS_CONTENT UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_ORGANISATIONS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_MEDIA_CAT_LKUP UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_MEDIA_CAT UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_INDIVIDUALS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_COUNTRIES UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_ADDRESSES);
    This is not working give ORA-00904: "LAST_PROCESSED" invalid identifier.
    I tried a SELECT from (....) as follows*
    select * from
    (select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS_ORGS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS_NOTES UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_SUBS_CONTENT_LKUP UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_SUBS_CONTENT UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_ORGANISATIONS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_MEDIA_CAT_LKUP UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_MEDIA_CAT UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_INDIVIDUALS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_COUNTRIES UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_ADDRESSES)
    This is woking perfectly. But when I tried to do max(*) i.e select max(*) from ......... gives error again.
    Can some one suggest me a query to full fill my requirement please.
    Thanks
    Rupesh
    www.orachat.com

    Hi, Rupesh,
    rupesh.sreenivas wrote:
    Hi ALL,
    I need to find max date from a union result. I tried to use bellow query,
    select max(last_processed) from
    (select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS_ORGS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS_NOTES UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_USERS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_SUBS_CONTENT_LKUP UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_SUBS_CONTENT UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_ORGANISATIONS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_MEDIA_CAT_LKUP UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_MEDIA_CAT UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_INDIVIDUALS UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_COUNTRIES UNION
    select max(date_processed) "last_processed" from GMD.CHANGELOG_ADDRESSES);
    This is not working give ORA-00904: "LAST_PROCESSED" invalid identifier.
    Anything inside quotes (including double-quotes) is case-sensitive. Everything not in quotes is capitalized before compiling. So
    last_processed is the same as
    "LAST_PROCESSED", but different from
    "last_processed".
    Don't use double-quotes.

  • How to find max(time) from table using group by

    how to find max(time) from table using group by
    select var max(time)
              from table
              into (var1, time1)
               where .....
                 group by var.
    it is fetching record which is top in table.
    if u can help?
    regards.

    No this will fetch the maximum time from teh table.
    select var max(time)
    from table xxxx
    into (var1, time1)
    where .....
    group by var.
    Refer this code
    TABLES SBOOK.
    DATA:  COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
    DATA:  CONNID LIKE SBOOK-CONNID.
    SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
           INTO (CONNID, COUNT, SUM, AVG)
           FROM SBOOK
           WHERE
             CARRID   = 'LH '      AND
             FLDATE   = '19950228'
           GROUP BY CONNID.
      WRITE: / CONNID, COUNT, SUM, AVG.
    ENDSELECT.

  • After installin Adoe phostoshop c6 and illustrator i open it then it no open because need the serial no.... i follo the steps to finde my serial no.and no real result to find it .. pleaaase help me how can i find e my seria no.. and howa y download the ph

    after installin Adoe phostoshop c6 and illustrator i open it then it no open because need the serial no.... i follo the steps to finde my serial no.and no real result to find it .. pleaaase help me how can i find e my seria no.. and howa y download the photoshop free ith no serial no and nolimit 30 days and no money? please get the link????

    Yasmine,
    Topic or subject titles should be clear, pertinent and concise so that individual users can tell at a glance if they can help or not.
    That field is not for attempting to fit your entire question in there.
    Please keep this in mind next time you post.  Thank you.

  • How to find the sum based on two variables

    Hello!
    I have just started using Numbers, I have a spreadsheet which lists a number of transactions.
    On my chart I have Columns "Date", "Memo", "Type", and "Amount".
    The Type column is a drop down list. What I want to do and find the sum for transactions that fall between a date range (i.e. months 1-3) and that match a certain "Type". I can figure out how to use the sumif function to find the sum for a date range, however I cant figure out how then to only sum only those that match a type.
    Any help?

    Brendon,
    This question arises from time to time in different situations. The answer is to first create an auxiliary column which calculates whether or not your multiple conditions have been met. In this case you have three - more than or equal a start date, less than or equal an end date, and a "Type".
    I'm assuming that your dates and "type" are flexible, so an extra table to enter your search data is shown below, but these three cells could be incorporated in your main table. The formula for the auxiliary column is:
    =IF(AND(Date>=Search Range :: A$2,Date<=Search Range :: B$2,Type=Search Range :: C$2),"SUM","")
    All rows with the word "SUM" satisfy the three conditions. The footer row contains the sum of the values meeting the desired conditions using:
    =SUMIF(Aux, “SUM”, Amount)
    Obviously this has to be reworked to your situation, but the auxiliary column is the key.
    pw
    Message was edited by: pw1840

  • To find max effdt from a table

    i am facing problem in finding max effdt for every employee from a table.
    i have to fetch emplid's from a table according to a particular deptid but there are many entries for a employee depending on effdt.I have to fetch the entry which is of max effdt.
    i wrote query like dis,is it ok?
    select emplid,effdt from ps_job where deptid='10000' and effdt in (select max(effdt) from ps_job group by emplid)

    You need to correlate the effdt and the empid is some fashion There are a few ways to do this. The closest correct way to what you have is:
    SELECT emplid, effdt
    FROM ps_job o
    WHERE deptid='10000' and
          effdt IN (SELECT MAX(effdt) FROM ps_job i
                    WHERE i.emplid = o.emplid)A one-pass method, assuming you can use analytics would be:
    SELECT emplid, effdt
    FROM (SELECT emplid, effdt, deptid,
                 ROW_NUMBER() OVER(PARTITION BY emplid
                                   ORDER BY effdt DESC) rn
          FROM ps_job o)
    WHERE deptid='10000' and
          rn = 1John

  • Find N max elements in unsorted array

    Hi guys,
    I want to find N max elements in unsorted array of integers in most efficient way as possible.
    I could sort and then find the max elements but there should be some way of optimising the performance.
    Any Ideas would be very much appreciated.
    Cheers
    J

    beginerjava wrote:
    I want to find N max elements in unsorted array of integers in most efficient way as possible. One idea is to keep the N largest items so far in a separate data structure. Say it's called NMAX_SOFAR. You need to keep track on the smallest item of NMAX_SOFAR. One way to accomplish this is to keep NMAX_SOFAR in sorted order. The leftmost item is then always the smallest.
    When the algoritm is started NMAX_SOFAR is filled with the N first items of the array. Then the remaining elements are visited one by one. For each item it's checked whether it's larger than the smallest item of NMAX_SOFAR. If it is, it's inserted into NMAX_SOFAR and the smallest item is removed. A new larger item becomes the smallest of NMAX_SOFAR. When all items in the array have been checked, NMAX_SOFAR holds the N largest items.

Maybe you are looking for

  • Sender file

    Hi, I am doing File sender Scenario. File come with filename+timestamp , I need to pick recent file and process it. ( I need to pick the present file and process the file) Is any parameters there in File adapter. Regards, Jayasimha Jangam

  • Which SAP Product version to assign to a Logical Component in SMSY (SOLMAN)

    Dear SAP Colleagues, In our SAP environment, we do have 2 versions of ERP systems : 1. CON - SIF - CDP systems are 'SAP ERP Central Component 5.0' product version. 2. CDD - CDT - CDP systems are 'SAP ECC 6.0' product version. Question : When I want t

  • I can not export my Final Cut Pro X Project

    Hi everyone I am seeking help big time! I have completed my FCP project on FCPX, but I can not export. When I click on "export project" it does nothing and when I send to compressor or trying to export by using compressor settings or trying to export

  • Black boxes appear instead of figures

    Hello, I am having a problem reading downloaded pdfs in Acrobat X Pro (on a PC): in many figures (or in random places on the page), black boxes will appear instead of graphs/tables/figures (or one column or another). If I open the pdf in my browser I

  • Nokia 6230

    please can anyone help me i am having trouble sending picture messages from my phone also when i turn my phone on it says"check connection settings" thank you