Transact-SQL (MSSQL) ::

Basic SQL, joining

+10 Transact-SQL (MSSQL)

For this test, you will need to demonstrate some basic SQL skills. There are two tables called #People and #Pets that contains a random amount of records. The table structures are as follows:

#People TABLE
Column DataType Size
ID INT 4
FirstName VARCHAR 100
LastName VARCHAR 100
#Pets TABLE
Column DataType Size
ID INT 4
PeopleID INT 4
Kind VARCHAR 100
Name VARCHAR 100

Your task is to produce the following table. Notice that some column names have been aliased and some have been combined. Also, it is important that only people with pets are in the resultset.

#Sample Result
HumanID HumanName PetID PetKind PetName
123 Smith, John 101 Cat Fluffy
124 Dole, Bob 102 Dog Spot