Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Exercises in t-SQL Expand / Collapse
Author
Message
Posted Tuesday, November 13, 2012 7:06 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, June 22, 2014 8:35 PM
Points: 12, Visits: 153
I'm in the process of setting up a training environment here, it's a mechanism for me to bring high flyers in from the business and give them somewhere to learn SQL.

I've got training content and t-SQL CBTs etc, but I was wondering whether there were any standard t-SQL exercises that I can make use of that are based on Adventureworks? Or if not, something that I could tailor for my environment?

Anyone know of any decent content? This would be from complete beginner up...
Post #1384074
Posted Tuesday, November 13, 2012 7:28 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:16 PM
Points: 5,567, Visits: 24,750
Not truly knowing your groups background and how deep in depth you wish to go with your training, may I suggest reviewing the "SPACKLE" articles here on SSC.

Just enter the term "SPACKLE" in the search window in the upper right hand corner of this page and give it a quick look over.



If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1384090
Posted Wednesday, November 14, 2012 7:44 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, June 22, 2014 8:35 PM
Points: 12, Visits: 153
bitbucket-25253 (11/13/2012)
Just enter the term "SPACKLE" in the search window in the upper right hand corner of this page and give it a quick look over.


That is actually quite useful, but not what I'm looking for (this will be of value though!). What I'm looking for is exercises for the guys to do (who could be literally learning how to write a SELECT statement for the first time). I.e. can you pick out all the staff called bob from adventureworks who are right handed (random!). That kind of thing. I can write a load up myself, but I'm hoping someone else has done it for me
Post #1384635
Posted Wednesday, November 14, 2012 11:57 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Sunday, July 20, 2014 7:16 AM
Points: 945, Visits: 1,769
I just wrote up a similar course and could not find any sample data to my liking. I started with Adventureworks but due to the multiple schema's decided against it for my class. went with a much simpler setup using only the default schema. i also looked at it as a good exercise for generating random test data. Really helped me in that area and i now am much more confident at creating the random data for testing queries if i dont have nice production data.

EDIT: I was able to find the CREATE TABLE and data inserts for the DB i used. It is based off of the script from Essential SQL on SQL Server 2008 by Sikha Bagui with some rather heavy modifications by me to better suit the 5 day course i wrote.



For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden for the best way to ask your question.

For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw

Need to Split some strings? Jeff Moden's DelimitedSplit8K
Jeff Moden's Cross tab and Pivots Part 1
Jeff Moden's Cross tab and Pivots Part 2

Jeremy Oursler


  Post Attachments 
CourseScript.txt (14 views, 136.49 KB)
Post #1384795
Posted Wednesday, November 14, 2012 5:12 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:40 PM
Points: 36,751, Visits: 31,200
T4FF (11/14/2012)
bitbucket-25253 (11/13/2012)
Just enter the term "SPACKLE" in the search window in the upper right hand corner of this page and give it a quick look over.


That is actually quite useful, but not what I'm looking for (this will be of value though!). What I'm looking for is exercises for the guys to do (who could be literally learning how to write a SELECT statement for the first time). I.e. can you pick out all the staff called bob from adventureworks who are right handed (random!). That kind of thing. I can write a load up myself, but I'm hoping someone else has done it for me


Create a million row FizzBuzz table. FizzBuzz isn't a comment. It's the name of a very common problem based on a child's game, is frequently given on interviews, and is actually a wonderful teaching tool to show people the difference between RBAR, Hidden RBAR, and Set Based methods that use "Pseudo Cursors". Have them do it with explicit loops, with a recursive CTE, without either of those at least 3 different ways, and then measure and discuss the resource usage and performance differences. So far as I'm concerned, it's one of the more important concepts in SQL Server.

The other exercise would be to teach people how to use Books Online and Google.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1384936
Posted Thursday, November 15, 2012 7:28 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 3:49 PM
Points: 191, Visits: 891
Try this:

[url=http://www.sqlcourse.com/index.html][/url]
Post #1385152
Posted Thursday, November 15, 2012 7:29 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 3:49 PM
Points: 191, Visits: 891
Well, that didn't work very well, did it. You get the picture.


http://www.sqlcourse.com/index.html
Post #1385154
Posted Thursday, November 15, 2012 6:54 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, June 22, 2014 8:35 PM
Points: 12, Visits: 153
Jeff Moden (11/14/2012)
Create a million row FizzBuzz table.


You saw this right??
T4FF (11/14/2012)who could be literally learning how to write a SELECT statement for the first time


I'd scare them back to their departments with that



Jeff Moden (11/14/2012)The other exercise would be to teach people how to use Books Online and Google.

True!
Post #1385412
Posted Thursday, November 15, 2012 7:08 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, June 22, 2014 8:35 PM
Points: 12, Visits: 153
I'm not sure if I've explained myself very well, as none of the suggestions are quite what I'm after. We've got training material, books, CBTs and coaching. What I'm after is exercises to give them to go away and figure out, scenarios....like can you tell me how many employees are over 50, can you tell me how many employees have red cars, can you tell me how many employees surnames begin with a etc etc
Post #1385415
Posted Thursday, November 15, 2012 7:44 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 15, 2012 7:33 PM
Points: 9, Visits: 0




Post #1385425
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse