SQL test SQL test
Page 1 of 4 123 ... LastLast
Posts 1 to 10 of 35

Thread: SQL test

  1. #1

    Richer than sasguru

    DimPrawn is a fount of knowledge

    DimPrawn's Avatar
    Join Date
    Jul 2005
    Location
    Brexit Britain
    Posts
    34,856

    Default 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. #2

    Banned

    Joe Black. has no reputation

    Joe Black.'s Avatar
    Join Date
    May 2006
    Posts
    276

    Default

    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.

  3. #3

    Godlike

    threaded is good enough for Jehovah!

    threaded's Avatar
    Join Date
    Jul 2005
    Location
    Fish'n'Chippery, Main St., Argleton
    Posts
    9,352

    Default

    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.

  4. #4

    Fingers like lightning

    kramer is too good to be a permie

    kramer's Avatar
    Join Date
    Mar 2006
    Posts
    981

    Default

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

  5. #5

    Richer than sasguru

    DimPrawn is a fount of knowledge

    DimPrawn's Avatar
    Join Date
    Jul 2005
    Location
    Brexit Britain
    Posts
    34,856

    Default

    No one man enough for the task?

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

  6. #6

    Fingers like lightning

    kramer is too good to be a permie

    kramer's Avatar
    Join Date
    Mar 2006
    Posts
    981

    Default

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

    is that correct?

  7. #7

    Banned

    Joe Black. has no reputation

    Joe Black.'s Avatar
    Join Date
    May 2006
    Posts
    276

    Default

    Quote 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).

  8. #8

    Better than AtW

    sasguru - scorchio!


    Join Date
    Jul 2005
    Posts
    36,272

    Default

    Quote 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

  9. #9

    Richer than sasguru

    DimPrawn is a fount of knowledge

    DimPrawn's Avatar
    Join Date
    Jul 2005
    Location
    Brexit Britain
    Posts
    34,856

    Default

    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?

  10. #10

    Still gathering requirements...

    bennyboy has no reputation


    Join Date
    Jun 2006
    Posts
    86

    Default

    Quote Originally Posted by zeitghost
    I'm watching some removals men across the road.


    Big gay green lizard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •