If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > A book on DB2 SQL ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-30-10, 17:54
d507201 d507201 is offline
Registered User
 
Join Date: Jul 2010
Posts: 2
Question 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
Reply With Quote
  #2 (permalink)  
Old 07-30-10, 18:02
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
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
Reply With Quote
  #3 (permalink)  
Old 07-30-10, 18:14
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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.
Reply With Quote
  #4 (permalink)  
Old 07-30-10, 18:35
d507201 d507201 is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 08-02-10, 00:22
dougt1736 dougt1736 is offline
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old 08-04-10, 11:29
jkuyken jkuyken is offline
Registered User
 
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.
Reply With Quote
Reply

Tags
sql guide

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On