Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Posts
    2

    Question Unanswered: A book on DB2 SQL ?

    I'm a new DB2 SQL users and am frustrated beyond belief. Yes, I know that 90% of SQL is standard but that 10% will kill you, right? I've purchased a couple books that purport to be DB2 SQL references but none of them are what I need. I need a DB2 SQL Users Guide -- something that is a reference for SQL queries only.

    I don't need DBA stuff. I need to know things like how to constrain a date in WHERE criteria... in Informix it's simply "where date between '01/01/2010' and '06/30/2010'" but apparently DB2 isn't that simple. Recommendations are GREATLY appreciated.

    Thanks in advance.

    John

  2. #2
    Join Date
    Jul 2009
    Location
    NY
    Posts
    963

    Red face Crying with you

    Quote Originally Posted by d507201 View Post
    I'm a new DB2 SQL users and am frustrated beyond belief. Yes, I know that 90% of SQL is standard but that 10% will kill you, right? I've purchased a couple books that purport to be DB2 SQL references but none of them are what I need. I need a DB2 SQL Users Guide -- something that is a reference for SQL queries only.

    I don't need DBA stuff. I need to know things like how to constrain a date in WHERE criteria... in Informix it's simply "where date between '01/01/2010' and '06/30/2010'" but apparently DB2 isn't that simple. Recommendations are GREATLY appreciated.

    Thanks in advance.

    John
    Don't cry, John, don't cry.
    In DB2 date operations are very simple:
    Code:
    where date_clmn between '2010-01-01' and '2010-06-30'
    Lenny

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by d507201 View Post
    I need a DB2 SQL Users Guide -- something that is a reference for SQL queries only.
    Did you try DB2 SQL Reference Manual, freely available for download on the IBM web site?

    You can also check DB2 SQL Cookbook


    Quote Originally Posted by d507201 View Post
    in Informix it's simply "where date between '01/01/2010' and '06/30/2010'" but apparently DB2 isn't that simple.
    It is that simple, actually:
    Code:
    select count(1) from syscat.tables where lastused between '01/01/2010' and '06/30/2010'
    
    1
    -----------
            264
    
      1 record(s) selected.

  4. #4
    Join Date
    Jul 2010
    Posts
    2

    The DB2 SQL Cookbook

    The IBM Reference Manual is too clumsy... It's not a user's guide and I can't quickly find things.

    The first half of the Cookbook is exactly what I need. You give this away for free? Amazing. Thanks!

    John

  5. #5
    Join Date
    Aug 2010
    Posts
    1
    I found SQL for DB2 by James Cooper to be a great guide.
    You want to learn and understand the best information about this type of database? This book is still my DB2 "Bible" so to speak.

  6. #6
    Join Date
    May 2010
    Posts
    21

    DB2 books

    Our work has the O'Reilly SQL cookbook, and I have to say that it is generally good, but occasionally our DB2 server rejects the code as invalid. It might be painful, but there is no real substitute for intelligent use of google/forums/getting your hands dirty. The edition of SQL cookbook references 'the recursive WITH' but it doesn't explain the issue half as well as an article I ran into after scratching my head: Port CONNECT BY to DB2

    Even so, I would love a better DB2 reference.

Tags for this Thread

Posting Permissions

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