SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to get better at writing queries?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

m1k3m41
Starting Member

9 Posts

Posted - 02/21/2013 :  14:47:11  Show Profile  Reply with Quote
I am new to SQL programming and just started my first class on databases in January. I find it hard to solve word problems even though I study the material extensively. Examples of questions are:

1) Find the SID of the student whose GPA is greater than that of student whose SID is 233.
2) Find the pharmacy that carries the drug that is most prescribed.

The problems that deal with more than 1 table gets me confused and I don't even know where to begin. I do perfectly fine when it is only involving 1 table. Do you guys have any tips on getting better at solving these problems and what steps I should take? Thank you very much.

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 02/21/2013 :  18:41:04  Show Profile  Reply with Quote
Keep reading this forum and see what other people are asking, and try to answer it yourself, and then see what other people did to solve it and try to understand what they did to solve it. You can always ask questions about what somebody did and why. A good first start, at least for me anyway, was to realize what is actually happening in the
SELECT
FROM
WHERE
construct. Did you know that SQL looks at the FROM 1st, the WHERE 2nd and the SELECT last?
I know this isn't much, but I hope it gets you started.

Good luck!

Jim





Everyday I learn something that somebody else already knew
Go to Top of Page

m1k3m41
Starting Member

9 Posts

Posted - 02/25/2013 :  12:56:34  Show Profile  Reply with Quote
Thanks Jim. So I'm guessing the only way to get better is through practice? I will try to do more problems. I just hope to be able to grasp this concept.. I usually don't know where to begin but once I see the answer, it seems like it was so easy....
Go to Top of Page

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 02/25/2013 :  13:02:06  Show Profile  Reply with Quote
Books are good. I really enjoyed Itzik Ben-Gan's t-SQL Fundamentals. I think it's important to get the fundamentals down early. I didn't do that (self-taught) and taught myself some really stupid things!

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

erikhaselhofer
Starting Member

30 Posts

Posted - 02/26/2013 :  01:20:33  Show Profile  Reply with Quote
quote:
Originally posted by m1k3m41

Thanks Jim. So I'm guessing the only way to get better is through practice? I will try to do more problems. I just hope to be able to grasp this concept.. I usually don't know where to begin but once I see the answer, it seems like it was so easy....


SQL is art, at least some of it. Sure, there's an underlying logic behind it all, but there's also something that clicks and says, "yeah, I can do that" even if you aren't sure how to do that. And, often, there's more than one way to do something. It makes it fun, at least to me.

My only disagreement with Jim, is that forums can be very hit or miss to learn from. You can get incomplete questions, complex questions that might, or might not be rational, and even the different flavors of SQL aren't consistent. Most people don't straddle the lines between different databases, so maybe that doesn't matter, but they all have different approaches to some things in some places and it can burn you if you aren't careful. However, odds are at your point, you aren't learning anything version specific. That said, they are a great place to see and try things you surely wouldn't have thought up on your own.

Anyways, if I had any advice it would be to try things that look weird, see what happens and always be prepared to be wrong. It'll happen more than once.

Good luck, have fun with it and don't beat yourself up over it.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000