• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

SQL test

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    SQL test

    name age salary
    ---------- ---------- ----------
    dan 23 67
    bob 45 94
    tom 24 94
    sue 23 45
    joe 45 51
    sam 22 51


    Write SQL to find the youngest person earning the highest salary.

    The answer is tom aged 24 by the way.

    Anyone?

    #2
    1.30 before kick off? Anyway it might classify as work and I'm trying to go the whole day without doing any. So far so good and only 1 hour to go.

    Comment


      #3
      Do your own homework!

      Bloody students. Mutter, mutter, mutter, grump, mutter.
      Insanity: repeating the same actions, but expecting different results.
      threadeds website, and here's my blog.

      Comment


        #4
        thinking about the football and putting off writing a vision/scope document...(WHY?).....this is gonna be even more painful on a friday
        --------------------------------------------------------------------------------

        SA - Is it like a dragons nostril?

        Comment


          #5
          No one man enough for the task?

          Typical contractors. I expect one the permies here eager to please will take up the challenge.....

          Comment


            #6
            select top 1 * from table order by salary desc, age asc

            is that correct?
            --------------------------------------------------------------------------------

            SA - Is it like a dragons nostril?

            Comment


              #7
              Originally posted by zeitghost
              I'm watching some removals men across the road.

              It's hot & they're making me feel tired...
              What kind of 'watching' are you doing. The kind where you touch yourself at the same time? Or are just interested in removalling (SIC).

              Comment


                #8
                Originally posted by DimPrawn
                No one man enough for the task?

                Typical contractors. I expect one the permies here eager to please will take up the challenge.....
                I'm a manager, dear boy.... I'll set it as a task for one of my minions. I myself am occupied with higher matters, such as which pub to watch the footie in.
                Hard Brexit now!
                #prayfornodeal

                Comment


                  #9
                  That's good, but the SQL engine has to do two sorts on the data and a top 1 to throw all the other rows away.

                  Any other ideas?

                  Comment


                    #10
                    Originally posted by zeitghost
                    I'm watching some removals men across the road.


                    Big gay green lizard

                    Comment

                    Working...
                    X