To sharpen the Query Logic

  • Hello SQL Gurus,

    I want to sharpen by logics in making efficient SQL queries. Is there any book or any website which provides questions on SQL queries ?

  • SQL Server Books Online should be your first resource in understanding how queries work.

    SQL Queries for Mere Mortals can give you the basics in writing the SELECT statement (the heart of all SQL queries).

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • What you are describing is a process not an event. There isn't a book you can read and when you finish you are now able to write efficient queries. One of the best ways to improve is to hang around there forums, try answering questions, read what others are doing, read lots of articles, try new stuff. Writing efficient queries is what is learned through experience.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Look for books and articles by Itzik Ben-Gan; his stuff on T-SQL is superb.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Hi Brandie, Sean, ScottPletcher, I understand there can be no book on T-Sql which you can finish reading and say "Yeah, I'm the man now". It was just like, if there are any books on T-SQL puzzles for newbees, some SQL challenges which can enhance the SQl writing skills. There must be some authors for MS SQL Server who love to write SQL challenges for different scenarios.

  • SQL challenges don't help you improve your query logic, they just encourage people to use what they know. If you're trying to sharpen your skills, read up on best practices and participate in the forums trying to help other people. And learn to use Profiler and execution plans so you can better understand the flaws in your code logic.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • sqlnaive (10/22/2012)


    Hi Brandie, Sean, ScottPletcher, I understand there can be no book on T-Sql which you can finish reading and say "Yeah, I'm the man now". It was just like, if there are any books on T-SQL puzzles for newbees, some SQL challenges which can enhance the SQl writing skills. There must be some authors for MS SQL Server who love to write SQL challenges for different scenarios.

    Gosh, if you want challenges, start answering questions on these forums.

    If you want some base method that can be expanded to solve various challenges, here's a link to a list of articles that can really help. I know the guy personally! 😉

    http://www.sqlservercentral.com/Authors/Articles/Jeff_Moden/80567/

    There are some great authors on the "Authors" link on the left side of the page. I'll also second Itzik Ben-Gan's books.

    Don't expect to get "smart" about it all overnight, though.

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

  • Hi Jeff, please don't take me wrong way. It's like there is so many material on mathematics, physcs, chemistry puzzles. As Microsoft SQL Server T-Sql is so much popular and there is lots of stuff, blogs out there in net and lots of information, there must be some sites, blogs or books totally and entirely focused on pure T-SQL stuff on scenarios based situation.

    Definitely there are some good questions in SQLServerCentral Question of the day and in some other sites but then those are not totally dedicated to t-sql. These are mix-ups of all the components of MS SQL. I was wondering if someone is interested mainly in developing Query writing stuff based on certain conditions, then there must be something for him/her.

  • sqlnaive, have you tried google yet? There are definitely challenges out there, if that's all you're interested in. And they should come up easily in a search engine.

    The key phrase is "T-SQL Challenges".

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Thanks Brandie, Jeff and All. Found few sites. :-):-):-)

Viewing 10 posts - 1 through 9 (of 9 total)

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