Basic SQL Exercises

  • I'm looking for a good website with practice problems or a good workbook (paper is fine). I've learned SQL but its been a couple of years since I've done a lot of "relational algebra." I would like something challenging enough from basic, intermediate maybe even advanced so i can sharpen my skills and see areas where i need to improve. I want something comprehensive.

    I don't know why there aren't books out there like math books where you just have hundreds of practice problems to build skills.

    Thanks!

  • Sorry do not know of a work book, but use these forums and try to answer any question on T-SQL BEFORE looking at any answer which has been posted by:

    Gsquared, Jeff Moden, Bob Hovious, Gila Monster(Gail Shaw), Lynn Pettis,

    Grant Fritchey, RBarry Young, Jack Corbett and many many others too numerous to mention.

    Here is an example to start you off (Not fair to look at Gsquared's post before you come up with your answer.)

    http://www.sqlservercentral.com/Forums/Topic684450-1291-1.aspx

    Compare your answer to their's and learn.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • bitbucket (3/27/2009)


    Sorry do not know of a work book, but use these forums and try to answer any question on T-SQL BEFORE looking at any answer which has been posted by:

    Gsquared, Jeff Moden, Bob Hovious, Gila Monster(Gail Shaw), Lynn Pettis,

    Grant Fritchey, RBarry Young, Jack Corbett and many many others too numerous to mention.

    Compare your answer to their's and learn.

    *affirmative*

    This forum is the best place to see how to solve practice problems in my opinion! Read a question, try to find your own solution and have a look for the others.

    Greets

    Flo

  • Agree here I have learned a lot reading posts here; another good part of this form is just not the answers the questions.

    You'll run into questions that you haven't thought of; that is case for me always. So I get to see new tricks, learned alot of T-SQL here. There is soo many new ways to do things in T-SQL; and guys here know the best way, sometimes it turns into interesting discussions over various different options :D.

    Mohit.

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].

  • MSDN has some good tutorials. That might be a good place to start.

    This site and related sites will be a really good place to find any gradient of difficulty you want. There are some really simple ones, mainly in the Newbies forums, and some really tricky ones in other spots. The Question of the Day is also good for one-datum-at-a-time stuff.

    (Have to admit I'm flattered about being included in the "don't cheat by reading their posts" list.)

    One thing that I find really helpful is having a database that I can play around in. I call mine "ProofOfConcept", and I generally keep it in Simple recovery mode. In that database, I can build tables with millions of lines of test data, write procs and functions, etc., and not have to worry about cluttering up even a dev database.

    When I work out something worth hanging onto, I save the scripts for it in a folder.

    Then, when that database gets cludged up, I drop and re-create it.

    That's made it really easy for me to learn and practice things, and to help people out on these pages, because I can run sample code in there.

    Just playing around, for fun, in that kind of database, is a good way to wrap your head around SQL concepts of pretty much any complexity.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Thanks guys. So what, I'd have to subscribe to a forum to get all the different posts? Much of what i see often goes over my head. I'll give it a try though. Newbies might be a good idea.

  • For a book, take a look at Joe Celko's Thinking in Sets.

  • Jacob Pressures (3/27/2009)


    Thanks guys. So what, I'd have to subscribe to a forum to get all the different posts? Much of what i see often goes over my head. I'll give it a try though. Newbies might be a good idea.

    Jacob,

    If you'll understand that they're teaching "ANSI" SQL and not the "T-SQL" that SQL Server uses, there's some pretty good stuff for learning the basics of SQL at the following link. It's all free and they even let you try stuff on screen without even having SQL Server or whatever. Here's the link...

    http://www.w3schools.com/sql/default.asp

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply