SQL

Discussion in 'SQL Exams' started by zxspectrum, Nov 9, 2008.

  1. zxspectrum

    zxspectrum Terabyte Poster Forum Leader Gold Member

    2,092
    216
    244
    Right im getting wound up as ive come up with several answers or this question but not the one that is meant to be right so if i post this link would someone help me out and tell me where im going wrong, slightly embarrassed as its only the second question, but i need to take a breather before i throw this laptop out of the window.

    http://sqlzoo.net/1.htm

    That is the link and the question number is 2, cant understand why i get loads of different answers that to me seem to be right, but then they are wrong

    Thanks in advance for whoever helps me stop being thick
    Ed
     
    Certifications: BSc computing and information systems
    WIP: 70-680
  2. Sparky
    Highly Decorated Member Award 500 Likes Award

    Sparky Zettabyte Poster Moderator

    10,718
    543
    364
    2a)
    Code:
    Select Name from bbc 
    WHERE population > 200000000
    2b)
    Code:
    Select name, gdp/population FROM bbc
    WHERE population > 200000000 
    Been a while since I have done SQL, good site that btw!
     
    Certifications: MSc MCSE MCSA:M MCSA:S MCITP:EA MCTS(x5) MS-900 AZ-900 Security+ Network+ A+
    WIP: Microsoft Certs
  3. zxspectrum

    zxspectrum Terabyte Poster Forum Leader Gold Member

    2,092
    216
    244
    ARGHhhhhhhhhhhhhhhhhh

    I cant believe i was being sooooo stupid

    i put this

    SELECT name from bbc WHERE population < 200000000

    and when that returned a message that it wasnt right i started changing everything else but not wat i needed to change

    Thanks for that Sparky

    Ed
     
    Certifications: BSc computing and information systems
    WIP: 70-680
  4. Sparky
    Highly Decorated Member Award 500 Likes Award

    Sparky Zettabyte Poster Moderator

    10,718
    543
    364
    No probs mate 8)
     
    Certifications: MSc MCSE MCSA:M MCSA:S MCITP:EA MCTS(x5) MS-900 AZ-900 Security+ Network+ A+
    WIP: Microsoft Certs
  5. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Being pedantic I'd say
    Code:
    select name, gdp/population as 'GDP' from bbc where population >= 200000000
    
    for 2b

    For 2c:
    Code:
    select name, round(population/1000000, 0) as 'population in millions' from bbc where region = 'Asia';
    
    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.