DBA best practices..from the DBA from Heaven

I met Tom Roush for the first time around 9 years ago – at a PASS Summit. If I recall right –  Kendra Little introduced him to me as a colleague from Microsoft and a friend of hers. I met him at several summits following that – found him a kind person with extraordinary cheer and warmth. Our friendship really took off when I started to read his stories. I am an aspiring writer myself, and hope to be one full-time some day. I loved his style of narration and the emotional appeal in them. One of my favorite ones was the one with three christmas trees, which was shared by someone on facebook. I posted a comment there on how much I liked the story. He responded and sent me a friend request. I write little story-like stuff on facebook from time to time – mostly real life happenings that have touched me in some way. He would send me private messages on the story. ‘I liked how you explained that’, ‘this line shows emotional maturity’, ‘on this line you have said this, but perhaps you meant that’…and so on. He did this entirely on his own – somehow sensing that the budding writer in me was so thirsty for feedback.  I learned from some mutual friends of his illness. I never asked him about it as I thought it was personal to him. He shared it on his own one day, and sent me link to the blog where his family wrote on his health and progress. I read it regularly. My mother had passed because of cancer. I knew from reading that his illness was serious and he had limited time.
Sometime during the fall last year – I got an offer to author a book from Apress publishers. It wasn’t exactly a book to write – but more like a series of interviews with data people who were very good at what they did. The choice of people to include in the book was up to me. Tom came to mind immediately. But I did not know if his delicate health would be able to stand the rigors of the hour long interview that the book demanded. So I asked him if he’d be willing to write the answers for me instead. I needed material to fill 10 pages – so there would be considerable typing involved. Tom sent me the answers. It was short of what I needed – so we decided to do another round – after his chemo last week. He said how excited he was to get his name on a ‘technical book’ and promised that he would do it. But that was not meant to happen. Below are Tom’s answers – for your reading. I sorely regret not being able to put them into the book and have it published while he was around. But we got it started, and now, people will read it for sure.  And if you are a DBA, double check if you are doing what he said. Because doing nothing is unacceptable. Even if you are battling cancer. The rest of us have no excuse. NONE EVER. Bill Gates said of Steve Jobs, on the latter’s passing – that knowing him was an ‘insane honor’. I want to say the same – knowing Tom was an ‘insane honor’.  I am honored to publish as below, Tom’s last interview.

1 Describe your journey into the data profession.

[Tom Roush: ] photography – first photojournalism, then freelance, created database to keep track of business – eventually used those skills to transition into IT

2 Describe a few things you wish you knew when you started your career, that you know now and would recommend newcomers to this line of work know?

[Tom Roush: ] I came into it from a photography background – where there’s the right way and every other way to do stuff – understanding in IT that there were SO MANY right ways to do something was really, really hard.

My path was something like this:

Health insurance company

application support

application developer

application administrator for group of 5 people

move to Microsoft

application support/administrator/developer (but for group of about 1000 people globally – comprising 10 databases (there’s more to this) all supporting MSN

report/graphing developer

Move to Getty Images

SQL developer

SQL dba dev/test/staging/load

SQL dba dev/test/staging/load/production

Move to Avanade

            SQL DBA dev/test/staging/prod

   

3 What is a typical day in your life as a professional?

[Tom Roush: ] this has been very interesting because there’s so much change in it. I used to be the sole dba, keeping about 140 servers running.  This was too much, the work/life balance was completely off, and we ended up expanding to a follow the sun model and hired 5 other dba’s to help me, and we ended up with three in India, 1 in Manila, 1 in Buenos Aires, and me in Seattle.  The Buenos Aires one transitioned to a fellow in Toronto.  My role in this is constantly migrating from being a production Tier2 dba to being a production Tier3 lead dba – meaning I will occasionally write code, I get called on for some deep troubleshooting, but a lot of my job involves checking email and trying to keep track of who’s doing what and deconflict various tasks that are being done on the same server.  So – a lot of my day is spent dealing with email from dev teams in  India, my ops team in India, Philippines, and Toronto, and then solving the problems they’re dealing with or unblocking them.  I also spend time passing on knowledge or training them.  A tremendous amount of what I do has to do with training my team, learning about and overcoming cultural issues.  This is tremendously important because the words we use are not necessarily heard the same way by the various people on the team.  Example: for a time I was dealing with the culture of all the folks mentioned above, and they all had varying skill levels, different work ethics, different things that motivated them. (What motivates the team in Bangalore is radically different than what motivates the fellow in Manila.)

 

5 Describe a few things which any data professional should know as best practices?

[Tom Roush: ] do not try to reinvent every wheel you need. 

Every problem you face will likely be a problem someone else has faced before.

Know that there are people who will want to help you if you are brave enough to ask.

Monitor, monitor, monitor – and know what to do when you discover something wrong.

When troubleshooting – start with the simple – but be prepared to go deep.

6 Describe a few things which any data professional should avoid as worst practices?

[Tom Roush: ] doing nothing (unacceptable)

No backups (unacceptable)

The 9 letters that can get you fired RPO/RTO/CYA

being a lone ranger.  Definitely get involved with others – don’t have lunch by yourself if you can avoid it; take the time to get away

 

8 Describe your experience with cloud adoption.

[Tom Roush: ] we have moved many of our systems, in whole or in part, to the cloud, from iaas, paas, and so on.

My personal experience has been that my team does the work

9 What are some of your favorite tools and techniques?

[Tom Roush: ] tools? Frankly, ssms is what works and what I can use.  Having the budget for tools I’d like to purchase has been an issue – so I end up either writing my own tools or finding tools/scripts out there.  Those would be:

Sp_whoisactive

The SP_blitz family of scripts

Ola Hallengren’s scripts

My own scripts – I write code so it’s dynamic – meaning it knows which datacenter it’s in, which environment it’s in – code that’s written this way may, for example, not have backups running in the test environment, but does have them running in production.  In essence, got a GPS on it.  The code is identical on each server, the variables are dynamically generated values for each individual server.

Etc.

11 What are your favorite books/blogs/other means of learning?

[Tom Roush: ] SQL skills, BrentOzar sqlserverperformance, sswug – various things that pop up in the twitter feed.

12 What are your recommended ways of stress management and developing healthy work-life balance?

[Tom Roush: ] flying in a sailplane, writing stories, walking by the beach, prayer, meditation, totally disconnecting from electronics (this is a struggle for me).

13 Describe your style of interviewing a data professional – what do you look for and what are some examples of questions you ask?

[Tom Roush: ] Conversationally – I use Brent’s interview questions with my own additions.  They’re always open ended questions that are very specifically real life types of scenarios.  I’ve been in the business long enough to be able to have a few.  I look for flexibility in thinking, the ability to start with the basic questions and work toward the complex, I also insist that they explain things to me in a non-technical way – like they would explain to an elderly relative.

Numbered questions are below

  1. If I give you a new sql server and tell you to set up backups, what do you do?
  2. tell me something about sql that mystifies you
  3. explain diff between a clustered index and nonclustered index.
  4. multiple users report sql is running slow for the first time today – what do you do?
  5. explain diff between simple/full/bulk logged recovery models.
  6. when you have to work on a server you’ve never touched, what’s the first thing you do?
  7. phone rings. server’s down – what are the first three things you do?
  8. tell me about your favorite script. what does it do?
  9. non urgent sql problem – can’t find answer in web search result.  what do you do?

10 urgent sql problem – down server. what do you do?

  1. a vendor app has slow queries, what are some ways you can do to make them faster?
  2. latest thing you learned the hard way about sql server.
  3. how to you keep from running a query on the wrong server?
  4. explain RPO and RTO (six letters that get you fired)
  5. name two ways you can tell sql has restarted unexpectedly the night before.
  6. situation: blocking, you get alerts, but you don’t know which db. What would you do to track this?

14 What are your contributions to community and why do you recommend people be involved iwth community?

[Tom Roush: ] I spoke at several SQL Saturdays, spoke at the SSWUG virtual conference for three years, blog, and I do my best to stay involved in community.

 

[Tom Roush: ] treat everyone with respect.  Know that not everyone has gotten to where they are using the same method you used, everyone has different experiences – and strengths come from those.

 

SQL Saturday Nashville 2018

I decided to go to the SQL Saturday at Nashville this year to get some good learning and networking in during frigid January. One of the reasons I wanted to go was that the line up for precons was amazing and I wanted to learn more on Azure particularly. I also wanted to submit to speak but that did not happen, for many reasons. I took the wednesday evening flight out of Louisville and got into Nashville late that night.
On thursday morning, after a light breakfast – I took a lyft ride to the school for a half day precon with Josh Luedemann called ‘Demystifying Data Movement in Azure’. We got to learn about PowerApps and Flow, Data Factory, and streaming data options in Azure. It was an interesting and informative 3 hour class. I went back to the lodging in the afternoon and spent my time reading and preparing for a presentation. There were already warnings out for a snowstorm on friday and I was beginning to get apprehensive regarding weather.

Friday morning arrived with news that school was closed for the day and there would be no precons. I was saddened as this was the main reason I had made the trip from Louisville. But it could not be helped – so spent most of the day at the lodging, reading and learning various stuff. Thankfully there were restaurants on ubereats that were still functioning – was able to get good food ordered in.

By Saturday the weather had cleared up – made my way into the school bright and early. It was cold but there was not much snow or ice around to worry about. There was coffee available for attendees – after getting some in made my way into the first class of the day – Azure Machine Learning 101 with Kathi Kellenberger. Kathi covered basics of AML and predictive analytics in a very down-to-earth manner. She mentioned things like being asked about ‘what was regression’ in an interview. I suspect all of us who claim to be playing around with ML must be prepared to face questions of this nature in future interviews. It was a timely warning to me personally to have those definitions handy as answers.

The class I had planned to attend next was cancelled – so I wandered into my friend and SQL Saturday co-organizer John Morehouse’s session on ‘How to put out Database fires’. John is a former firefighter, and he used many analogies in comparison to drive in the importance of best practices and doing database administration safe way. I thoroughly enjoyed the class.

The next class I went to was Chris Hyde’s session on ‘Python in SQL Server 2017’. I had already attended the same session at PASS Summit, but still felt that I could use a refresher – so went in again. Really enjoyed the simple examples and tips and tricks on how to get started with Python.

After a quick bite of lunch I walked into a panel discussion on cloud – with many talented folks including Bradley Ball, Josh Luedemann, Jason Horner, Hope Foley and Gareth Swanepoel  There were many questions raised and answered with regards to cost, feasibility, cool new features and so on. It was very worth attending.

The next session was also a repeat one for me –  ‘Data Cleansing with SQL and R’ – with Kevin Feasel.  I greatly enjoyed it.

The last class of the day was ‘Twitter Data & Sentiment Analysis: Staring Logic Apps, Azure ML, Twitter Data, Power BI, and Python’  by Bradley Ball. Bradley has always ranked very high on my list of favorite speakers – he is a total natural on stage. In this class he explained using various tools to scrape twitter for movie related comments, cleaning that data and ultimately presenting it in PowerBI as a report on how the movie performed with public. It was very well researched and incredibly fascinating class for me.

After the class I touched base with several friends whom I had not seen in a while – said my good byes and left early. Although the day long class for which I had traveled in for did not happen – I was able to get a very good day of learning and networking in. The event was well organized and there were a lot of happy attendees as well. Thank you to organizers, speakers, sponsors and attendees for a good show, and hope to revisit Nashville next year too!

 

 

 

 

T-SQL Tuesday #97 Roundup: Learning goals for 2018

SqlTuesday

T-SQL Tuesday is a monthly blog party started by respected SQL Guru Adam Machanic. I was honored with hosting this month’s party. I picked a topic that is important for me at this time of the year – setting learning goals. I was surprised and somewhat overwhelmed to see the number of responses. I learned a lot reading what every person had to say. Below is the summary.

1 Rob Farley talks of tuning learning to what customers look for – which is a good idea for most of us. He also explains being interested in certifications and Microsoft EdX course for data science. This seems to be a certification many people are interested in. (Rob may not need as much ‘learning’ to do it as some of us as he is one of those who passed MCM without a lot of prep 🙂

2 Andy Leonard talks of learning more on cloud based offerings. He also explains challenges with managing businesses, home-schooling children and various challenges it presents with managing time. Andy is considering getting up at 5 AM to find time to learn – I must confess that I went ‘wow’ reading that because am not a morning person and that speaks for so much dedication. There is no shortcut to hard work and here is a prime example.

3 John Deardurff talks of finishing what he started – John is the certification guru of #sqlfamily, he has every cert imaginable under his belt and has listed a few more to go, in addition to finishing a college degree. Again, nothing short of inspiring.

4 Bert Wagner talks of learning more DBA skills as a developer to architect solutions better. Bert has also included a fun little video talking of his goals, very worth watching and very creative. He mentions the importance of creating demo-s as a way of learning.

5 Blogging rockstar and my own personal inspiration to blog – Brent Ozar talks of learning and creating  gamification techniques  around technology design such as cloud deployment strategies. Gamification techniques are intended to leverage people’s natural desires for socializing, learning, mastery, competition, achievement, status, self-expression, altruism, or closure, or simply their response to the framing of a situation as game or play. (Yes I had to google that and read up on what it was!). I can’t wait to read more of what he comes up with in this regard and I’ve always found his ideas to be incredibly creative.

6 Michelle Haarhues talks of learning more on Microsoft Azure and passing related certification exams. She compares tech learning goals to fitness goals and likes learning at Starbucks compared to home. She ends her post with a well-worded crisp mission statement on her goal.

7 Jeff Mlakar talks of one of my favorite topics – time management. His post includes a very good video-lecture on this topic. It is very worth watching. Jeff’s goals include MCSE, blogging,speaking at various sql saturdays and networking.

8 Steve Jones, one of my best friends and mentors in the community talks of various challenges that come up with setting structured goals in general, following a book or a course to the end (his experience with powershell is almost exactly the same as mine), and tracking goals. Steve’s post resonated with me in many ways.

9 Deborah Melkin aka Deb the DBA talks of learning better automation of testing techniques and her own style of learning – visual and kinesthetic. She explains the importance of matching how we learn to our learning style and has also included a link on learning styles.

10 Chris Voss talks of completing his MBA program and focusing on skills he needs as a data architect. He mentions the importance of DBA fundamentals as well as using the SQL community slack channel.

11 Long time sql community member and security guru Brian Kelley talks of maintaining MCSE and CISA certifications, as well as doing the data science certification.  He talks of the difference between just getting a certification and gaining knowledge as part of the process.

12 Garland McNeill talks of list of skills to gain as a DBA and the importance of working complex problems as a way of assimilating the learning.

13 Tracy Boggiano talks of being inspired by Andy Warren’s talk on ‘Building a Professional Development Plan’ at the summit. I’ve heard Andy deliver this talk too and have been similarly inspired. Her goals including getting better at unix, talking at more events (she has spoken at 18 sql saturdays last year – well done Tracy!) , and learning more on SQL Server 2017.

14 Marek Masko talks of earning MCSE on cloud platform, speaking at double the number of conferences than he did this year and attending local events in Poland. He also has a great list of books on database engineering that are worth considering for any of us.

15 Taiob Ali’s goals include Microsoft Big Data Certification,Architecting Azure solutions and learning more on powershell. He also wants to contribute more to #sqlhelp answers and stack exchange.

17 Melissa Connors from SentryOne writes on learning more on documentation and communication – she includes links to courses on EDx related to this, it is a very interesting list. She also includes some pictures of getting to her goal of baking macaronis (yum!) and training her dog Trekker.

18 Samir Behara’s goals include technical certifications and learning more on cloud technologies. He has made an interesting analysis of correlating website traffic and speaking engagements, showing that speaking increases visibility to the blog as well.

19 Glenda Gable’s goals include getting technical certifications, learning more using Brent Ozar’s training, blogging and using MSDN for labs. Glenda is also interested in being partners for accountability towards our goals.

20 Todd Kleinhans wants to learn more on Linux, Hekaton and do the Microsoft Data Science program, in addition to a number of personal goals. Todd has a lovely habit of writing hand written notes of thanks or appreciation for any number of things and posting it on social media. He did one of this blog party too which I will share towards the end.

21 Former PASS Community Evangelist and BI Architect Cathrine Wilhelmson talks of her goals that include learning more BIML, speaking, blogging, teaching and researching. She wants to revisit her post in December too to find out how she did.

22 Lucas Kartwidjaja talks of learning more of AWS/Azure via online courses and also do more of cloud architecture.

23 David Hiltenbrand has many interesting things to learn on his list including CosmosDB, graph databases, Adaptive Query processing via several online courses. He also plans to attend SQL Saturday Nashville (hope to see you there David!).

24 Martin Catherall from down under talks of general trends around learning and the importance of learning something deeply.

25 Stuart Moore blogs about doing more networking, improving his writing skills, doing more automation (everybody should!) and getting better at marketing himself. I could see eye-to-eye with every one of those goals myself.

26 Doug Purnell has a very interesting link on tendencies when it comes to goal setting – there is a test there that seems informative (mine came up as ‘questioner’, which I am) – I guess one needs to read the book he recommends to find out how this helps in setting a plan and making it work.

27 Andrew Tobin writes on getting into a new job that is 100% sql server, learning more related sql server stuff online, blogging without ‘getting personal’, answering questions on Stack Exchange and doing videos on performance tuning. Good luck Andrew!

28 Shane O Neill uses a joke to explain the many things he has on his list to cover next year including Azure, CosmosDB, containers, python and so on. It is a really creative way of presenting a plan and fun to read.

30 Jason Squires talks of many things he wants to learn including XEvents, Powershell and  Availability Groups – he also includes his goals to improve on blogging and speaking at online events.

32 My good friend and mega blogger Kenneth Fisher writes on his own ‘eclectic’ learning habits and includes cloud,t-sql,performance tuning and learning more on metadata. Ken recommends starting to blog slowly to build up momentum – a great tip for new bloggers.

Thank you to all of you for taking time to contribute. I like the suggestion made by Glenda Gable on being partners to help with accountability on our goals. If anyone feels up to this just leave a comment below, we can set up a slack channel or something similar to help each other.

Merry Christmas and Happy New Year!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T-SQL Tuesday #97 – My learning plan

SqlTuesday

This month’s T-SQL Tuesday is hosted by…er..yours truly. I picked a topic that usually comes up for me every December – learning goals for the next year. This is the first time that I am blogging about it.

Usually this review is accompanied by a strange combination of imposter syndrome, guilt and thoughts like ‘how about not having goals’,’who cares’,’I want to retire’,’I am never going to be as good as so-and-so’ and so on. In short, it has rarely been a pleasant experience.  A lot of people me included, want to learn a lot in the little time we have. We underestimate other life challenges that get in the way, and also our own power to assimilate and actually use what we learn.  We also have different degrees of focus and methods of learning that work for us and there is no one fit for all. This year I decided to be more pragmatic and take all of those things into consideration while making a learning plan. I took into consideration below:

1 I can devote about an hour a day to learning on a normal day – this excludes days when I am on call and have had a late night, or some kind of a personal stressful situation.
2 I learn best by in person classes, followed by podcasts and videos.
3 My areas of interest are wide – DBA work with BI/Data visualisation. I need to pick what I want to learn carefully.
4 I consolidate well when I apply at work(true for almost everyone), teach/present and blog.
5 I network better in small crowds and familiar places.
6 I usually walk for about an hour in the evening. I can use that time to listen to podcasts.
7 My ‘lab time’ is the time I spend actually putting what I learn to actual practice – is typically about 2-3 hours late Saturday afternoon.

Keeping all this in consideration, my plan is as below:What to learn:My areas of focus are as below:

  • SQL Server: Azure, Powershell and Extended Events
  • Non SQL Server: CosmosDB or MongoDB, Beginner Level Python, Mid level R
  • Data Visualisation: PowerBI
  • Certification: Microsoft Professional Program in Big Data


How to learn:

1 Pluralsight will be my main tool to begin with since it is easy and affordable. The goal is to try and get in 1 hour of pluralsight training per day on good days.
2 I will be attending select sql saturday precons as a second option, particularly for Azure and Data Science related training. I’ve set aside a budget for this and will only be able to do those events that fall within the budget. Chances are that none may.
3 I will be watching PASS Summit recordings and Ignite recordings for additional info. I don’t consider either of these as in depth learning but more as informative sessions.
4 I will be using Edx for the Microsoft Professional Program in Big Data.
5 I will be attending TechOutbound (formerly SQL Cruise) in March and the PASS Summit later in the year for networking. Additional networking will be possible with sql saturdays if they happen – most definitely with my own sql saturday event in July.
6 I found a treasure of podcasts that are out there that I can listen to on my evening walk. My favorite site for them is sqldownunder, by Greg Low. But there are several others – list here. These are my insurance that I get *some* learning in even if all the rest of the stuff does not work out. Listening during exercising is easy and exercising is something I do with a passion.

How to apply:
1 I am somewhat limited in terms of how much I can travel, for many reasons. So, I will be presenting at several virtual chapters and also user groups that allow remote presentation. Right now the goal is 5 presentations, more depending on time.
2 I plan to blog at the rate of one blog post per week. I’ve come to this as a result of a lot of experimentation and this works well for me. Every other week will be a non technical post since I have a lot of non technical info to blog about.
3 I do not consider application of learning to work as something I can blog about, so not writing more on that.

I also plan to journal weekly on how I did in the past week and tune myself as I go.By ‘journal’ I don’t mean writing pages – just a simple excel sheet where I review what I learned versus what I wanted to learn. If I go for three weeks without meeting any goals I am doing something wrong and need to re adjust. Am hoping to keep my pace with this better and do better as I go.  I think this is vitally important. It is not a bad thing that we failed to meet our goals but it may be bad if we never even considered tracking our progress through an entire year.

One of my favorite movie scenes is from ‘Gone with the wind’, where there is a garden clock with the lines ‘Do not squander time, it is the stuff life is made of’..right next to it is a cat sleeping blissfully. That sums up time management in general – you can’t force it. You have to take little steps, be consistent, and factor in all the other things that go into how you use your time. I hope to be better at it this year than I was in the years before.

 

 

 

 

 

 

 

 

 

Dealing with disquiet

Last week I listened to a podcast from one of my best friends in the sql community – Kendra Little. In this podcast Kendra talks of her encounter with anxiety attacks and how she dealt with them. When I listened to her honest, moving story – my mind was filled with thoughts on the many episodes with anxiety i’ve dealt with, each of its own kind. I was also moved by how many people in the community wanted to hear about stories like this to feel reassured on their own journey. So, here is one of my own. I am tagging a friend at the end of it ,hope he will tag someone else, and we can have a worthy collection of stories to refer to if we need help/reassurance.
Many years ago, I worked as a Senior DBA cum team-lead at a big firm. I was doing DBA work, and also helping my boss manage a team of six other people. My boss was a very kind,intelligent,generous man, one of the best I’d worked for.I greatly enjoyed my role and the work.A few years down the line, my boss got passed up for a promotion he richly deserved. After that his attitude and behavior changed.He started to be a no-show at important meetings,didn’t respond to emails, took time off without notice, and so on. One day, his boss decided to forward one of his meeting invites to me.I went, and filled in for him.The next day, I got more of his work. And then more. Soon, I was doing two people’s work, and working 12-14 hours a day. I wanted to speak to someone about this, but I kept putting it off with the hope that my boss would come around and get back to doing his stuff. I still really liked the job, and kept up with my needs for food, exercise etc too with the demanding schedule. At least I thought I did. One day, I started to feel some pain around my shoulders. I rubbed some balm on it and hoped it would go away. The next day, there was some tingling sensation in my feet, followed by some numbness and brief giddiness. I started to become very jittery and noise-sensitive. Somebody honking on the street would bother me for hours, with my hair standing on end and my heart beating extra loud. I had never had these symptoms before, and as Kendra mentioned – my life was going well according to me. So, what was wrong?

After a few days into this – as I was driving to work one morning, there was more loud honking on the busy street I had to use. My whole body was thoroughly shaken. Instead of going in to work, I drove myself to the ER – firmly convinced that I had some strange disease. They did all kinds of tests on me – brain mri, abdominal CT, heart exams, everything – pronounced me fine and sent me home in two days, with some medication to help me sleep better.

Two days later, I went in to the dentist for an unrelated problem with my wisdom tooth, still worried and firmly convinced that I had some unknown illness. While taking xrays of my teeth, the dentist said he noticed that my jaw bones were not aligned – a condition called TMJ. I asked him about my symptoms, and he nodded yes, I had TMJ , one of the major causes is stress and can be treated. This diagnosis was followed by a visit to a jaw specialist, some braces to wear and LOTS of relaxation therapy/counselling. After 2 months my ordeal was finally over. My TMJ still comes back  now and then to remind me that I overwork or am not taking enough care of myself. But I know how to handle it now. Needless to say I moved on from that job shortly after.

Below are the lessons I learned from that episode and what I follow as practices for mental (and physical health), dealing with stress and anxiety.

1 Respect your body – Your body is an entity of its own. One of my friends likes to joke that you are its boss before 50 and it is your boss after. That is mostly true (you are never its ‘boss’, it just cooperates better when it is younger). Your body does not care how much you love your work or how long you want to do it. It is undoubtedly true that liking what we do leads to more mental happiness, it is not true that it is a safeguard against self care. Avoid the line ‘I love what I do’ as an excuse to skip meals/skip exercise/not getting enough sleep/not taking vacations or less family time. It is not worth it and can hurt you, a lot.

2 Connect with spirit – Kendra talks of this as going back to church/community where she could find succor/replenishment for spirit. I don’t particularly care for community worship, for many reasons. To me, connection with spirit happens with doing things that bring me joy – reading books I love, particularly books on women’s empowerment(‘Women who run with wolves‘ is my favorite), visiting book stores, antique malls, doing gardening, drawing or painting. Spirit is available in a place that is safe and free of rules, and those are the spaces for me.

3 Practice personal reassurance –  I believe each person needs this in their own way. To me seeing art I enjoy , favorite pictures from vacations/with friends/family, or some phrases that resonate with me are very reassuring when I get anxious. I keep good art all around me, and phrases from books like ‘Tao of Pooh’ or ‘Jonathan Livingston Seagull’. I also invest money in enlarged prints of photographs taken on family vacations or sqlfamily reunions around me. They serve to enrich how I feel through the day. I change them around periodically but make sure that I see them – not just give passing glances but really ‘see’, standing in front of them, and re-live pleasant, happy moments.

4 Practice deep breathing and guided meditations. I recall a quote I read long ago – ‘Slow breathing is like an anchor in the midst of an emotional storm: the anchor won’t make the storm goes away, but it will hold you steady until it passes’. I practice it whenever and wherever i can, with my hand on my belly, where I feel my breath the best. It calms me down like nothing else. As a sound sensitive person, I love meditations that come with bilateral stimulation – a scientifically proven way to relax your brain. One of my favorites is here. Another awesome one called soft-belly meditation is here.

5 Understand your triggers and work with them – majority people who have anxiety have to deal with it periodically, it never really goes away fully. It teaches lessons in self acceptance that are invaluable. To me – I am triggered by loud noise, heavy traffic,  noisy crowds and certain argumentative/demanding situations. And, as I learned from this particular anxiety episode, I need to find time for self reassurance. I don’t accept or work jobs that do not leave me time to balance these aspects of my life. As writer Stephen Covey says, that becomes like driving without finding time for gas. The car is going to stop, whether you like it or not.

Last but not the least, get help when your body reacts in ways you do not understand. I cannot stress this enough. Sometimes help is the first doctor you go to. Sometimes it takes longer and needs different types of doctors/healers/therapists/techniques. But persist. We live in an era where so much information is available online – search for information, ask friends on facebook or other social media on what they think.  I am personally very grateful for the many people I have befriended because of the issues I have had – kind, sensitive, beautiful people who have taught me the value of life and importance of living in the moment. I hope to be the same to anyone who needs help with anxiety, stress or similar.

I tag one friend here – Tim Costello – to narrate his story. Tim, pass it on to someone else after you, and thank you.

“The most beautiful people we have known are those who have known defeat, known suffering, known struggle, known loss, and have found their way out of the depths. These persons have an appreciation, a sensitivity, and an understanding of life that fills them with compassion, gentleness, and a deep loving concern. Beautiful people do not just happen.”

– Elisabeth Kubler Ross

 

14 years of Summit…

I have been trying to get my blogging going again after a gap of two months. It has been incredibly hard. To warm up, I decided to try some non technical posts. One of them is stuff I have been wanting to write a long time – with this year I will complete attending 14 years of PASS Summit. It has been a while. There are people who have attended every single summit – I am by no means the record holder for that. But attending the same conference and being part of the same community for 14 years is still something to be proud of, and am very proud of it.

For the first 3 years  – I could not afford the entire summit. I was a junior DBA cum programmer back then, on a work visa, making about 65K or so per year. Money was hard, and the summit wasn’t cheap. For my very first summit at chicago, I could only afford to pay my way for one day. (I think it was 300 to 400 dollars). The hotels close to the summit were expensive, so I took a Greyhound bus from Louisville. (I do not like to drive long distance on my own , and nobody I knew was going). I landed in Chicago early morning, attended a day’s class and took the bus back same day evening. Most of what was said during the day went above my head. All I did with SQL server back then was backups, restores, attaching and detaching databases, and creating a few DTS jobs. But, I saw many passionate people. I was inspired by their love of what they do, and wanted to be part of them. So, whether I learned anything or not, didn’t matter much. I wanted to come back here, to this community, although I didn’t know a single soul among them. I did this for 2 more years.
The year 2005 was at Grapevine, TX. I had received a modest bonus at work – could afford airfare and two days of hotel. So off I went again, to hang among these very excited strangers and try to understand a wee bit of what they were saying, or doing. During lunch break – I was wandering around and stopped at a table with a bald man and another lady. They seemed very friendly. The bald man was Rushabh Mehta, one of the board members at PASS. He asked me if I had a user group at Louisville. I said no, and he asked me if I was interested in starting one. I was mostly an introverted person. I did not know how to get word around or how to get people to attend a user group, even if I started one. I expressed these concerns. He reassured me that he would help with mailings and would also get the local Microsoft people to help. What he said next made my heart leap – they offered free attendance to entire conference for running a user group!! I decided to go for it. On my way back from TX – I knew one person now. I had Rushabh’s contact information. While sitting at the airport terminal waiting for my flight home – I saw another lady with a PASS backpack. I asked her if she was from Louisville – and she responded , yes. It was just two of us from our little town at the conference.  I explained what Rushabh had told me, and asked her if she would help me start up the first meeting for our user group. She was interested. Teresa Mills was the second person in the SQL community whom I got to know, via attending a PASS conference.
The first meeting of Louisville SQL Server user group started in 2006, at the local library, with 12 people in attendance. Some of those folks are still with me as volunteers for SQL Saturday and for the chapter. After that, I started going to the summit every year. Some years, I got my employer to pay the whole way. Some other years, I had to pay for hotel. Or the airfare. In some rare cases, I had to take paid time off to go. I also volunteered for PASS in every capacity I could – I wrote for their newsletter, mentored new attendees, served on selection committee, worked as a Tech Ed volunteer, moderated 24HoP – everything I could in the time I had.
Now, after 15 years, I know a LOT of people in the community. It is many times difficult to find time for all of them. I have never had to look for work the traditional way – all my jobs after I started the user group have been because of referrals  – people I know in community telling others that am good at what I do.  Last year I was awarded the PASSion award for best volunteer – the highest recognition a volunteer can get. I am sure glad to have boarded the Greyhound bus that night into a city and among people I never knew or understood. I hope you find it in you to take that find step. You never know where it will take you.

Getting back to blogging

The past two months have been very hectic for me. I had an unexpected job offer towards end of July, which I gladly accepted – that was followed by some much needed home renovation, and a long vacation/tour of the west coast with my beloved sister. All of this has taken a toll on my regular blogging practice.
I am currently working as a database consultant with Fortified Data Services. I work remotely, 100 % from home – and with a group of very talented people. Working remotely has also given me the much needed flexibility I was looking for. I am looking forward to learning and growing with this new team.
I am now settling down at the new gig and the home is also falling in shape. I decided to become a minimalist after years of dealing with stuff – getting rid of things that I don’t need or use has been a growing/healing experience for me after I entered mid age. It has completely changed and improved my perspective on life itself – being light, taking things lightly and seeing everything in a better light.
Thank you to everyone who have been following my blog posts and hope to resume regularly starting this week!!

 

 

Dataset for Cochran-Mantel-Hanzel Test

Below is the script to create the table and dataset I used. This is just test data and not copied from anywhere.

USE [yourdb]
GO
/****** Object: Table [dbo].[DrugResponse] Script Date: 6/12/2017 6:45:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIERl ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[DrugResponse](
 [seqno] [int] IDENTITY(1,1) NOT NULL,
 [Batch] [smallint] NOT NULL,
 [Drug] [char](1) NOT NULL,
 [Response] [char](1) NOT NULL,
 CONSTRAINT [PK_DrugResponse] PRIMARY KEY CLUSTERED 
(
 [seqno] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[DrugResponse] ON

GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (1, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (2, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (3, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (4, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (5, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (6, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (7, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (8, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (9, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (10, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (11, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (12, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (13, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (14, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (15, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (16, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (17, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (18, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (19, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (20, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (21, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (22, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (23, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (24, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (25, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (26, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (27, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (28, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (29, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (30, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (31, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (32, 1, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (33, 1, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (34, 1, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (35, 1, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (36, 1, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (37, 1, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (38, 1, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (39, 1, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (40, 1, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (41, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (42, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (43, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (44, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (45, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (46, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (47, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (48, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (49, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (50, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (51, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (52, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (53, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (54, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (55, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (56, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (57, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (58, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (59, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (60, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (61, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (62, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (63, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (64, 1, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (65, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (66, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (67, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (68, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (69, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (70, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (71, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (72, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (73, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (74, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (75, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (76, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (77, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (78, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (79, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (80, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (81, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (82, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (83, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (84, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (85, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (86, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (87, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (88, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (89, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (90, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (91, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (92, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (93, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (94, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (95, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (96, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (97, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (98, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (99, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (100, 1, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (101, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (102, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (103, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (104, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (105, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (106, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (107, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (108, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (109, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (110, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (111, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (112, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (113, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (114, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (115, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (116, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (117, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (118, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (119, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (120, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (121, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (122, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (123, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (124, 2, N'A', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (125, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (126, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (127, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (128, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (129, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (130, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (131, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (132, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (133, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (134, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (135, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (136, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (137, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (138, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (139, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (140, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (141, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (142, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (143, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (144, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (145, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (146, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (147, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (148, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (149, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (150, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (151, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (152, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (153, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (154, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (155, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (156, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (157, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (158, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (159, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (160, 2, N'A', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (161, 2, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (162, 2, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (163, 2, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (164, 2, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (165, 2, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (166, 2, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (167, 2, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (168, 2, N'B', N'Y')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (169, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (170, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (171, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (172, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (173, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (174, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (175, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (176, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (177, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (178, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (179, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (180, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (181, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (182, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (183, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (184, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (185, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (186, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (187, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (188, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (189, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (190, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (191, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (192, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (193, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (194, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (195, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (196, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (197, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (198, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (199, 2, N'B', N'N')
GO
INSERT [dbo].[DrugResponse] ([seqno], [Batch], [Drug], [Response]) VALUES (200, 2, N'B', N'N')
GO
SET IDENTITY_INSERT [dbo].[DrugResponse] OFF
GO

SQL Saturdays – down memory lane

A casual twitter-conversation with Karla Landrum and some other peeps led me down memory lane on older events. Our SQL Saturday at Louisville will be 9 years old this year. We were event #23, in 2009. SQL Saturdays started two years before, in 2007.

Our first event was held at a training center – 2 tracks, 6 speakers, 29 sessions submitted, 3 sponsors and about 60 attendees. We outgrew that location the very next year. Our present event has 6 tracks, close to 300 attendees, 109 sessions submitted so far.

The 22 events before us were as below:
1 Orlando, FL
2 Tampa, FL
3 Jacksonville, FL
4 Orlando, FL
5 Olympia, WA
6 Cleveland, OH (did not actually happen).
7 Birmingham, AL
8 Orlando, FL
9 Greenville, SC
10 Tampa, FL
11 Tacoma, WA
12 Portland, OR
13 Alpharetta, GA
14 Pensacola, FL
15 Jacksonville, FL
16 South Florida
17 Baton Rouge, LA
18 Orlando, FL
19 East Iowa, IA
20 Jacksonville, FL
21 Orlando, FL
22 Pensacola, FL

A lot of the Florida events are past their 10 year anniversary. Many others will be having one this year or next year. This means 10+years of free training to many, networking opportunities, small businesses that have profited by providing services and vendors who have <hopefully> found more customers. If you attend any of these events make sure to thank the organizers – an event is a LOT of work to organize and doing it for 10+ years is no mean achievement – it takes considerable motivation and hard work. Some of my personal choices of memories around 9 years of running this include –

1 I did not have breakfast/coffee delivered once. This is probably the biggest thing I remember that went wrong during my decade of running the event. The food vendor had an employee who was new to town and made his delivery somewhere else (pre GPS days). I still recall that frantic morning with upset speakers and repeat calls to the food vendor.

2 One of the free locations we hosted our event in once threatened to cancel on us on the Friday before. The reason given was that there was ‘an inch of snow’ on the ground and they did not want to risk anybody’s safety. I was on my way to speaker dinner, and had to turn around to talk to them and convince them otherwise. One inch of snow is a big deal for some people. My team and the only volunteer we have left from those days – Deana, has stories on planting signs on the road on a frozen morning. Needless to say, we never had an event in winter ever again.

3 We had 8 tracks at one event. There was a new speaker who was doing her first talk and had nobody show up at her class. She was in tears. We never overdo how many tracks we have after that.

4 Among my other favorite (smaller) memories of the decade include –
1 A lady DBA who was also a new mom attended the WIT session we had with Kevin Kline and Karen Lopez. She was close to quitting her job and decided to stick on after she heard them.
2 One of my events happened to fall on my birthday. Some of the attendees got a big cake and I had a ‘happy birthday’ sung to me by hundreds of people.
3 Wendy Pastrick, one of the PASS board members appreciated our event as among the best organized smaller events.
4 Tim Ford convinced me to attend SQL Cruise during my of events. I’ve attended a cruise every year since then.
5 Hearing attendees talk about ‘do you remember 5 years ago…we came here..’ – never tire of that, ever.

Thank you to all the organizers of the events above for your dedication and hard work..and hope to keep this going as long as we can!! If you are an organizer of any of the above events – do write more on your favorite memories!!

Thanks for reading.

 

 

 

 

 

 

 

 

Sampling Distribution and Central Limit Theorem

In this post am going to explain (in highly simplified terms) two very important statistical concepts – the sampling distribution and central limit  theorem.

The sampling distribution is the distribution of means collected from random samples taken from a population. So, for example, if i have a population of life expectancies around the globe. I draw five different samples from it. For each sample set I calculate the mean. The collection of those means would make up my sample distribution. Generally, the mean of the sample distribution will equal the mean of the population, and the standard deviation of the sample distribution will equal the standard deviation of the population.

The central limit theorem states that the sampling distribution of the mean of any independent,random variable will be normal or nearly normal, if the sample size is large enough. How large is “large enough”? The answer depends on two factors.

  • Requirements for accuracy. The more closely the sampling distribution needs to resemble a normal distribution, the more sample points will be required.
  • The shape of the underlying population. The more closely the original population resembles a normal distribution, the fewer sample points will be required. (from stattrek.com).

The main use of the sampling distribution is to verify the accuracy of many statistics and population they were based upon.

Let me try demonstrating this with an example in TSQL. I am going to use [Production].[WorkOrder] table from Adventureworks2016. To begin with, am going to test if this data is actually a normal distribution in of itself. I use the Empirical rule test I have described here for this.  Running the code for the test, I get values that tell me that this data is very skewed and hence not a normal distribution.

DECLARE @sdev numeric(18,2), @mean numeric(18, 2), @sigma1 numeric(18, 2), @sigma2 numeric(18, 2), @sigma3 numeric(18, 2)
DECLARE @totalcount numeric(18, 2)
SELECT @sdev = SQRT(var(orderqty)) FROM [Production].[WorkOrder]
SELECT @mean = sum(orderqty)/count(*) FROM [Production].[WorkOrder]
SELECT @totalcount = count(*) FROM [Production].[WorkOrder] where orderqty > 0

SELECT @sigma1 = (count(*)/@totalcount)*100 FROM [Production].[WorkOrder] WHERE orderqty >= @mean-@sdev and orderqty<= @mean+@sdev
SELECT @sigma2 = (count(*)/@totalcount)*100 FROM [Production].[WorkOrder] WHERE orderqty >= @mean-(2*@sdev) and orderqty<= @mean+(2*@sdev)
SELECT @sigma3 = (count(*)/@totalcount)*100 FROM [Production].[WorkOrder] WHERE orderqty >= @mean-(3*@sdev) and orderqty<= @mean+(3*@sdev)

SELECT @sigma1 AS 'Percentage in one SD FROM mean', @sigma2 AS 'Percentage in two SD FROM mean', @sigma3 as 'Percentage in 3 SD FROM mean

In order for the data to be a normal distribution – the following conditions have to be met –

68% of data falls within the first standard deviation from the mean.
95% fall within two standard deviations.
99.7% fall within three standard deviations.

The results we get from above query suggest to us that the raw data does not quite align with these rules and hence is not a normal distribution.

pic1

Now, let us create a sampling distribution from this. To do this we need to pull a few random samples of the data. I used the query suggested here to pull random samples from tables. I pull 30 samples in all and put them into tables.

 SELECT * INTO [Production].[WorkOrderSample20]
 FROM [Production].[WorkOrder]
 WHERE (ABS(CAST((BINARY_CHECKSUM(*) * RAND()) as int)) % 100) < 20

I run this query 30 times and change the name of the table the results go into, so am now left with 30 tables with random samples of data from main table.

Now, I have to calculate the mean of each sample, pool it all together and then re run the test for normal distribution to see what we get. I do all of that below.

DECLARE @samplingdist TABLE (samplemean INT)
 
 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample1]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample2]
 
 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample3]
 
 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample4]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample5]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample6]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample7]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample8]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample9]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample10]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample11]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample12]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample13]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample14]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample15]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample16]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample17]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample18]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample19]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample20]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample21]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample22]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample23]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample24]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample25]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample26]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample27]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample28]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample29]

 INSERT INTO @samplingdist (samplemean)
 select sum(orderqty)/count(*) from [Production].[WorkOrderSample30]


DECLARE @sdev numeric(18,2), @mean numeric(18, 2), @sigma1 numeric(18, 2), @sigma2 numeric(18, 2), @sigma3 numeric(18, 2)
DECLARE @totalcount numeric(18, 2)
SELECT @sdev = SQRT(var(samplemean)) FROM @samplingdist
SELECT @mean = sum(samplemean)/count(*) FROM @samplingdist
SELECT @totalcount = count(*) FROM @samplingdist
SELECT @sigma1 = (count(*)/@totalcount)*100 FROM @samplingdist WHERE samplemean >= @mean-@sdev and samplemean<= @mean+@sdev
SELECT @sigma2 = (count(*)/@totalcount)*100 FROM @samplingdist WHERE samplemean >= @mean-(2*@sdev) and samplemean<= @mean+(2*@sdev)
SELECT @sigma3 = (count(*)/@totalcount)*100 FROM @samplingdist WHERE samplemean >= @mean-(3*@sdev) and samplemean<= @mean+(3*@sdev)

SELECT @sigma1 AS 'Percentage in one SD FROM mean', @sigma2 AS 'Percentage in two SD FROM mean', 
@sigma3 as 'Percentage in 3 SD FROM mean'The results I get are as below.

pic2

The results seem to be close to what is needed for a normal distribution now.

(68% of data should fall within the first standard deviation from the mean.
95% should fall within two standard deviations.
99.7% should fall within three standard deviations.)

It is almost magical how easily the rule fits. To get this to work  I had to work on many different sampling sizes – to remember the rule says that it needs considerable number of samples to reflect a normal distribution. In the next post I will look into some examples of using R for demonstrating the same theorem. Thank you for reading.