SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Exercises in t-SQL


Exercises in t-SQL

Author
Message
T4FF
T4FF
SSC-Enthusiastic
SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)

Group: General Forum Members
Points: 128 Visits: 184
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...
bitbucket-25253
bitbucket-25253
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19809 Visits: 25280
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
T4FF
T4FF
SSC-Enthusiastic
SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)

Group: General Forum Members
Points: 128 Visits: 184
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 :-D
CapnHector
CapnHector
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4219 Visits: 1789
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
Attachments
CourseScript.txt (43 views, 136.00 KB)
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (271K reputation)SSC Guru (271K reputation)SSC Guru (271K reputation)SSC Guru (271K reputation)SSC Guru (271K reputation)SSC Guru (271K reputation)SSC Guru (271K reputation)SSC Guru (271K reputation)

Group: General Forum Members
Points: 271139 Visits: 42207
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 :-D


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.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
vikingDBA
vikingDBA
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1668 Visits: 929
Try this:

[url=http://www.sqlcourse.com/index.html][/url]
vikingDBA
vikingDBA
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1668 Visits: 929
Well, that didn't work very well, did it. You get the picture.


http://www.sqlcourse.com/index.html
T4FF
T4FF
SSC-Enthusiastic
SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)

Group: General Forum Members
Points: 128 Visits: 184
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


:-D 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!
T4FF
T4FF
SSC-Enthusiastic
SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)

Group: General Forum Members
Points: 128 Visits: 184
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
starshayiz
starshayiz
SSC-Enthusiastic
SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)

Group: General Forum Members
Points: 161 Visits: 0





Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search