Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to learn how to write complex queries?

Status
Not open for further replies.

Janet95

Technical User
Jun 6, 2006
45
US
You know the saying give a man a fish and he’ll eat for the day, but teach a man how to fish and he’ll eat for a life time.

I often see many talented people responding, with relative ease, to questions about queries that I think are very complex. I’ve purchased SQL for Dummies and Access 2000 programming books, but they only teach the basic types of queries. They don’t get into multiple where statements or where to place all those parenthesis. Are there any books or websites resources that anyone would suggest? What would you suggest is the best way to learn how to write complex sql/access queries?
 
Having had a basic idea of SQL before joining Tek-Tips, I've learned the most just by reading posts by other users and trying to solve the issues myself, trying to contribute when I can.

I learn the most, however, by looking at examples and soltuions by some of our experts here (many from my own questions). Everyone you see on the MVP list is responsible for my expanding knowledge of VB and SQL. If you have a basic understanding of SQL, I'd save some money and keep visiting tek-tips...work through some problems, post questions of your own, and hang in there! This way you'll be able to decide for yourself if SQL is something you really want to learn.

As far as references go, check out mp9's website. He has a great list of source material:

~Melagan
______
"It's never too late to become what you might have been.
 
Thanks, Melagan.


I have just started looking at tek-tips the other day and I have noticed that you reply to question often. I wish I could be on your level one day. [smarty]

It must be a very rewarding and gratifying feeling knowing that you have helped someone "see the light", who was probablly stressed out for days over the solution.

Thanks for the link. I'll check it out. [bigsmile]
 
Another good one is Understanding SQL Joins. If you don't understand how the joins work, you won't be able to get the really complex queries.

The most motivating component to my increasing SQL skills is a completely non-normalized database. Having to work with bad data really makes you learn all the tricks to getting the correct data with a query.

Your comment about all the Parenthesis - note that ONLY JET SQL (Access specific) requires the Parens around all the joins.

Other than that, it's just looking at what the "experts" do and trying to figure out how it works. If you're not sure, feel free to post the SQL and ask questions about what you don't understand and someone can explain it to you.

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 
One of the best sites I know of is Rudy Limeback's site. If you click on the Ask The Expert link (may need free registration), Rudy has several hundred examples from the introductory to the complex with good explanations of how and why they work.
 
Thanks Leslie and Golom.
I have also seen that your also very active in tek-tips, Leslie.

I've already begun the hunt for knowledge at the sites you have provided. Thanks so much for the insight.

Who knows, in a year or less maybe I'll be answering more questions than posting them here on tek-tips. [sunshine]
 
While I agree with the learn by doing approach advocated, I would also recommend you acquire at least on (but not more than perhaps two) of the tomes on JUST SQL. In most of these fora (and many other sites), the participants are trying to solve their real-world problems. This is quite valuable, but often leave out some approaches which do not fall into the specific area of interest.

As one example, most of the discussion in MS Access (JET) fora rely almost exclusively on "Joins". In most instances, joins can be replaced with subqueries. In some situations, subqueries provide a 'better soloution', For example, a join to show a subset of missing value is (at least for me) much easier with the subquery than the Join expression. Could (or course) just be that my few remaining neurons are wired weired?




MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top