April 17, 2012 at 2:17 pm
Hello Everyone,
I am very new to SQL. I am at the stage where "I don't know what I don't know". Thus, please let me know how and where do I start learning SQL?
My goal is to use SQL to create BI reports. Thank you very much.
April 17, 2012 at 2:47 pm
Hi and welcome to SSC! Best thing you can do is get a copy of sql express. Then get a copy of adventureworks database. You can find both of those very easily with your favorite search engine and they are both free.
There are tons of tutorials using that database from both microsoft and hundreds of other spots around the internet.
Start hanging around the forums on here. Post questions, get involved.
SQL Server is an absolutely huge topic and you have to roll up your sleeves and dive in to learn it.
_______________________________________________________________
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/
April 17, 2012 at 2:54 pm
Also, before posting questions, please read the article Forum Etiquette: How to post data/code on a forum to get the best help[/url]. Follow the instructions provided in that article and give us the DDL for your table(s), sample data for the tables, expected results, and the code you are having problems with.
Doing this will get you the best help possible, quickly, and will provide tested code in return.
April 17, 2012 at 8:12 pm
My recommendation would be to not use SQL Express even though it's free especially if you want to get into BI. My recommendtion would be to buy a copy of the SQL Server Developer's Edition (between 40 and 60 USD). It's the same as the Enterprise Edition but with special licensing and will run on a desktop box without Windows Server being installed. It's well worth the investment.
Then, make a trip to one of the many SQL Tutorial sites (like w3schools.com) to learn the bare bones basics of SQL. Once that is done, post back here and I'll show you some links to some articles that are really good for reporting.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 18, 2012 at 2:28 am
April 18, 2012 at 9:25 am
How new are we talking about here? You might want to start at wikipedia then work into books online.
http://en.wikipedia.org/wiki/Relational_database
http://en.wikipedia.org/wiki/Database_model
http://en.wikipedia.org/wiki/SQL
http://en.wikipedia.org/wiki/Join_(SQL)
http://msdn.microsoft.com/en-US/library/ms187752(v=sql.90).aspx
http://msdn.microsoft.com/en-us/library/ms189826%28v=SQL.90%29.aspx
http://msdn.microsoft.com/en-US/library/ms187928(v=sql.90).aspx
After reading all that you'll probably have an idea of what you don't know.
April 18, 2012 at 10:32 am
Thank you all for the great recommendations. I will get started today. I will visit this site as much as possible. Thanks.
April 18, 2012 at 7:28 pm
nhutlu,
Having been in your shoes about 1 year ago, I think I'm qualified to respond to you.
First of all, you need to gain a conceptual understanding of what SQL can do in the most general of terms. Know the WHAT and learn the HOW. That is where I was about 1 year ago.
The next thing you'll need to teach yourself is visualizing basic data transformations. In other words, you've got input set A and you need results set D. So you need to visualize how to get from A-->B-->C-->D. Now you need to teach yourself the HOW between each data transformation. I did it mostly by trial and error, but also with a little help from Google (and of course this site). As your skill level progresses, you'll find that you'll soon be able to visualize more and more complex data transformations. Never forget the basic SQL concept of working in sets and not resorting to RBAR.
Force yourself to avoid CURSORs in the first 6 months. Apply best practice solutions to your visualized transformations, and allow yourself to struggle if you must, but stick to my first sentence. Your target should be to use no more than 5 CURSORs in your career (I've used up 3 of mine but I'm thinking of rewriting one of my earlier pieces of code to get that down to 1 :-)). Don't even bother to learn the syntax of CURSORs so being forced to look it up everytime will be a deterrent to use (it is for me).
Practice, practice, practice. Look at other peoples' problems (e.g., on this forum) and try to solve them. If you come up with something that works, post it on the forum. If you don't, hey at least you tried and probably found a couple of things that didn't work. Review solutions posted by others and challenge people to prove their solutions are better than yours. Or take a solution that someone else posted and try to improve it yourself. That's how you learn.
Do not let the vast body of SQL knowledge distract you from focusing on the specific areas of interest and/or applicability to things you need to get your work done. But by all means read in areas that are outside of what your immediate need is. Learn about best practices and look for opportunities to apply them, whether in work or in play. Better to learn it in play, so that when you need it in work you can get it done quicker.
Think out of the box. When you see the same solution to a similar problem posted over and over, it is always refreshing to see a new approach. Surely someone has tried it (there's probably very few brand-spanking new solutions posted) in the past, but if its new for you then that again is called learning. Don't be afraid to try something new and fail, because that failure is also learning.
Don't rely too heavily on solutions you Google unless they come from a trusted source. After awhile, you'll know who these are. Often times I see the same basic solution coming up multiple times on Google and then a little deeper research reveals that it is far from the best. Compare alternatives and judge for yourself. Never settle for the status quo. Evolution (or God depending on your perspective) gave Man this thing we call a brain - use it. You'll be surprised what it can do if you just give it a chance.
Above all, when you post a question or an answer on this forum and you get a condescending response (no names but we all know who I'm talking about here), don't let it get you down. Learn what you can from it (he's usualy right), apply it if you can but sometimes we all know that we must often live with the mistakes of others. You're doing your best if you can simply not repeat them for yourself.
And have a little fun with it. I know I am.
Hope you find this encouraging.
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
April 18, 2012 at 7:40 pm
One thing I'd like to stress that dwain.c mentioned above. Do not be afraid to fail. You actually learn more from your failures than your successes. It is alright to fail, even if current thought is no one can fail.
Just pick yourself up, dust yourself off, and try again.
April 22, 2012 at 11:37 am
dwain.c (4/18/2012)
nhutlu,Having been in your shoes about 1 year ago, I think I'm qualified to respond to you.
First of all, you need to gain a conceptual understanding of what SQL can do in the most general of terms. Know the WHAT and learn the HOW. That is where I was about 1 year ago.
The next thing you'll need to teach yourself is visualizing basic data transformations. In other words, you've got input set A and you need results set D. So you need to visualize how to get from A-->B-->C-->D. Now you need to teach yourself the HOW between each data transformation. I did it mostly by trial and error, but also with a little help from Google (and of course this site). As your skill level progresses, you'll find that you'll soon be able to visualize more and more complex data transformations. Never forget the basic SQL concept of working in sets and not resorting to RBAR.
Force yourself to avoid CURSORs in the first 6 months. Apply best practice solutions to your visualized transformations, and allow yourself to struggle if you must, but stick to my first sentence. Your target should be to use no more than 5 CURSORs in your career (I've used up 3 of mine but I'm thinking of rewriting one of my earlier pieces of code to get that down to 1 :-)). Don't even bother to learn the syntax of CURSORs so being forced to look it up everytime will be a deterrent to use (it is for me).
Practice, practice, practice. Look at other peoples' problems (e.g., on this forum) and try to solve them. If you come up with something that works, post it on the forum. If you don't, hey at least you tried and probably found a couple of things that didn't work. Review solutions posted by others and challenge people to prove their solutions are better than yours. Or take a solution that someone else posted and try to improve it yourself. That's how you learn.
Do not let the vast body of SQL knowledge distract you from focusing on the specific areas of interest and/or applicability to things you need to get your work done. But by all means read in areas that are outside of what your immediate need is. Learn about best practices and look for opportunities to apply them, whether in work or in play. Better to learn it in play, so that when you need it in work you can get it done quicker.
Think out of the box. When you see the same solution to a similar problem posted over and over, it is always refreshing to see a new approach. Surely someone has tried it (there's probably very few brand-spanking new solutions posted) in the past, but if its new for you then that again is called learning. Don't be afraid to try something new and fail, because that failure is also learning.
Don't rely too heavily on solutions you Google unless they come from a trusted source. After awhile, you'll know who these are. Often times I see the same basic solution coming up multiple times on Google and then a little deeper research reveals that it is far from the best. Compare alternatives and judge for yourself. Never settle for the status quo. Evolution (or God depending on your perspective) gave Man this thing we call a brain - use it. You'll be surprised what it can do if you just give it a chance.
Above all, when you post a question or an answer on this forum and you get a condescending response (no names but we all know who I'm talking about here), don't let it get you down. Learn what you can from it (he's usualy right), apply it if you can but sometimes we all know that we must often live with the mistakes of others. You're doing your best if you can simply not repeat them for yourself.
And have a little fun with it. I know I am.
Hope you find this encouraging.
Except for the 1 year thing and certain condescending posters usually being right, I absolutely agree.
Think out of the box.
I have a piece of art that I commissioned a friend to draw for me and it has provided a certain amount of inspiration at different times. It's a picture of a big ol' fat cat with a Cheshire grin sitting in a litter box. The wording at the top of the picture is "Before you can think outside the box, you must first realize.... you're in a box!". 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.
April 23, 2012 at 1:19 am
Well the fact that you posted here tells me you're off to a good start :hehe:
My 2c worth:
:: Don't let people belittle your trade by telling you "SQL is easy". SQL is easy the same way baseball is easy. Anyone can have a bit of fun with it in the backyard but that's a far cry from being a pro. You want to be a pro.
:: Don't accept that the local hero lauded round the office is a guru just because your colleagues say he or she is. Sometimes it's OK to quietly challenge local thinking by experimentation and using respected resources like SSC and SimpleTalk.
:: Don't assume that the solution to one problem will always be a solution to apply to ostensibly similar problems. For example your local "guru" gives you a bit of code that gets out the right group of rows for you, and works great on your 5,000 row table. When you apply that solution to a 5,000,000 row table, you may be in for a rude surprise.
:: Do courses. As expensive as they are, see if you can get your business to send you on courses periodically (our organisation's budget extends to 1 course of three days per year). There are hidden benefits to courses, two of which are (1) that they get you out of the office for a few days and free your mind from the humdrum non-SQL distractions that might stop you learning at work, and (2) you get to mix with your SQL peers. This helps you realise there are real people experiencing the same issues as you.
:: Try to find time to learn new things yourself (regardless of whether your organisation can afford to send you on courses). Would you go to a surgeon who had not updated her skills in the last 10 years?
:: Document, document, document. Put meaningful comments in your code, and give your objects thoughtful names (not #temp or column1). People need to know what you're thinking, when they look at your code.
...One of the symptoms of an approaching nervous breakdown is the belief that ones work is terribly important.... Bertrand Russell
April 24, 2012 at 3:15 am
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply