Tag: syndicated

  • The Basics of Joins – Skill #4

    This series of blog posts are related to my presentation, The Top Ten Skills You Need, which is scheduled for a few deliveries in 2011.

    Databases are built to store data. That’s the primary purpose, and in SQL Server, we store data in a relational form. That means that often we have data spread across multiple tables. Why we do this is a discussion for another day, but suffice it to say that we often have structures like this:

    personcontact

    Part of the person.contact table in AdventureWorks above and the HumanResource.Employee table below.

    employee

    One typical join task might be to get an employee’s name, or a list of employees and their names. Here we have a birthday in the Employee table, but we don’t have a name. That’s in the Person.Contact table. Essentially we want to match these up using basic, elementary school set theory.

    settheory

    In the diagram above, you can think of each letter as a row in a table. As an example, let’s assume that B in the orange circle represents the row in the employee table with a ContactID value of 4. The B in the pink circle would represent the row in the Contact table with a ContactID value of 4 as well.

    When we join these to get the Employee name and birth date, we get:

    join2

    I used a join in my query to get that:

    SELECT 
      c.firstname
    , c.LastName
    , e.BirthDate
     FROM person.contact c
       INNER JOIN HumanResources.Employee e
         ON c.ContactID = e.ContactID
     WHERE c.ContactID = 4
     

    In this query I’ve included two tables in the FROM clause with the INNER JOIN key phrase between them, which specifies I only choose the matching rows. The match is made in the ON clause.

    I’ve also qualified this to only apply to the row with a ContactID of 4 in the WHERE clause.

    There’s a lot more you can do with joins, and you can include more than two tables, such as this query:

    SELECT 
      c.firstname
    , c.LastName
    , e.BirthDate
    , pa.AddressLine1
    , pa.AddressLine2
     FROM person.contact c
       INNER JOIN HumanResources.Employee e
         ON c.ContactID = e.ContactID
       INNER JOIN HumanResources.EmployeeAddress ea
         ON e.EmployeeID = ea.EmployeeID
       INNER JOIN person.Address pa
         ON ea.AddressID = pa.AddressID
     WHERE c.ContactID = 4
     

    I would recommend that you practice working with basic joins, based on the information that you commonly see queried in your application. Sooner or later someone will ask you for some data that isn’t available in the application and you will want to write a query to extract it for them.

  • It’s Your Career

    It’s your career. It’s something you have to take ownership of and work on. I know that life is busy, and training budgets are tight. That’s one reason we started SQL Saturday; it’s a way to bring a training event and a conference experience to many people.

    fun2

    I posted this tweet almost a year ago, seeing Brent in a class somewhere, learning and taking notes during some session. It was in humor, but I’m a little serious here. We all have more to learn, and while you don’t need to cram it all in this year, you should be taking advantage of your user group, local events, conferences, classes, even reading something in a newsletter on a regular basis.

    Many of us are out here to help. I’ve spoken at 12 events this year, 10 of them free, and will be at another free event this week (SQL in the City – LA). However, you’ve got to make the effort to improve yourself. I , and many others, will try to help you, teach you, but you’ve got to do some work yourself.

    Pace yourself, learn at a reasonable rate given the other responsibilities in your life, but don’t ignore this aspect of your career.

    PS – If you’re in the LA area, there’s still time to register for SQL in the City and get a free day of training. I’ll also be at DevConnections next week and SQLInspire the week after that.

  • Fun Pix

    Various photo uploads from the past year.

    fun8

    fun7

    fun6

    fun5

    fun3

    fun2

    fun1

  • Penance

    Buck Woody wrote a fantastic post this morning for speakers to think about. All too often I have seen some speakers at technical events adopt the prima donna stance, expecting gifts, special treatment, free food and drinks, and more. I do think that events should try to recognize speakers when they can, but for smaller events, gifts and dinner can be hard. Ultimately I want events to be sustainable, with 100 SQL Saturdays a year and there isn’t enough money to make them all lavish smorgasborghs of delight for those that present.

    speakersThere was a bit of a discussion recently about cancellations and penalties for speakers at events. Cancellations happen, and sometimes are unavoidable, however they have a huge impact on organizers. There are any number of reasons for cancellation, some legitimate, some suspect, and since Andy Leonard likes elegant solutions, I have one:

    If you cancel speaking at an event, the event bans you from speaking the next time they have the event. You get an appeal to the program committee to state your case, but their decision is final.

    But Steve, my wife broke her arm and I had to leave early. Why can’t I speak next year?

    I completely understand. If you have a family emergency, or you’re sick, cancel. Take care of you and yours. That’s understandable, no one can blame you, and you can appeal to the committee and state your care.

    However do your penance. There’s no entitlement here for speaking. I believe in making the decisions that are ethically and morally just for each person, but then be man or woman enough to stand up for your decision, regardless of the consequences.

    I cancelled on SQL Connections a couple years ago because my wife broke her arm as I was landing in Denver between events. I wasn’t speaking, but had committed to help cover the event for my company. They would have been justified in telling me they wouldn’t pay for me to attend anymore. And I would have accepted that as a result of my decision.

    I cancelled on the Louisville SQL Saturday this past January, after I had submitted a session and been accepted. I gave them as much notice as I could, in this case I told them in Nov and they had two months. My reason: my middle son’s black belt test was the same day.

    I am still apologizing to Malathi for my decision, and if she decides not to allow me to speak anymore, or any other SQL Saturdays cite that as a reason to not choose me, I accept the consequences.

    We are adults, we are professionals, and if our other obligations intrude and override our commitment to speak, accept the consequences. It might suck, but it’s the adult thing to do.