Well, I'm going to post the entire Q&A here. This is all based on the Northwind sample DB. The interviewer did state on the phone and in his email that I should search on the internet for any answers, so I don't feel bad about posting it here for review.
Technical Assessment Q&A
Please answer all questions below to the best of your ability. Use any online resources you can find to assist you with the answers. Put your answers in blue text within the body of the email message and reply to this email once complete.
Question 1: What is the result of running the following queries?
Delete MyDataTable
A: The DELETE command as stated above would remove MyDataTable entirely, as well as all data contained within it.
Select MyDataTable.z
From MyDataTable inner join MyOtherDataTable
on MyDataTable.z = MyOtherDataTable.z
Where MyDataTable.z = 'AValueThatExistsOnceInBothTables';
A: The result would display all rows where the value 'AValueThatExistsOnceInBothTables' is found in both the MyDataTable and MyOtherDataTable tables.
Question 2: what is the difference between a clustered and a non clustered index?
A: A clustered index is the default column which a table is sorted by, and generally the same as the primary key. Since a table may only have one clustered index, if queries are often performed using other columns within the table, those queries may be slow to return results. A non-clustered index may be created to add a second(third, etc.) index for other columns, which will expedite results when searching within those columns.
Question 3: What Is the difference between an Inner Join and an Outer Join?
A: An inner join produces the intersect of both tables, displaying only the records they share in common. Outer joins do not require common records, they will display all records from both tables, returning null when no corresponding data from the other table exists, depending on whether the outer join is left-, right- or full.
Question 4: In the attached database schema, write a query that returns the all products of the category “Condiments”. Show product name, Quantity per unit, unit price, units in stock, units on order.
SELECT Products.ProductName, Products.QuantityPerUnit, Products.UnitPrice, Products.UnitsInStock, Products.UnitsOnOrder
FROM Categories
INNER JOIN Products
ON Categories.CategoryID = Products.CategoryID
WHERE Categories.CategoryName = 'Condiments'
Question 5: In the attached database schema, write a query that returns the total amount of all orders placed in the system, the total amount discounted of all orders placed in the system.
SELECT SUM(UnitPriceQuantity) as Price, SUM(UnitPriceQuantity*Discount) as [Discounted Price]
FROM OrderDetails
Question 6: In the attached database schema, write a query that returns a list of all orders (order ID, customer company name, customer contact name, order date, shipped date, unit price, quantity, total price, supplier company name) In many records the supplier does not exist so make sure your query returns all orders and NULL values for any that does not have a supplier record.
SELECT Orders.OrderID,
Customers.CompanyName,
Customers.ContactName,
Orders.OrderDate,
Orders.ShippedDate,
OrderDetails.UnitPrice,
OrderDetails.Quantity,
SUM(OrderDetails.UnitPrice*OrderDetails.Quantity)
Suppliers.CompanyName
FROM Orders
FULL JOIN
ON Orders.OrderID = OrderDetails.OrderID
FROM Customers
FULL JOIN
ON Customers.CustomerID = Orders.CustomerID
FROM Products
FULL JOIN
ON Products.ProductID = OrderDetails.ProductID
FROM Suppliers
FULL JOIN
ON Suppliers.SupplierID = Products.SupplierID
Question 7: All Shippers in our system are potential Customers. Create a TRIGGER on the table SHIPPERS that when a SHIPPER CompanyName is added, Create a record in the CUSTOMERS table automatically.
CREATE TRIGGER trig_NewCustomer
ON Shippers
FOR INSERT
AS
BEGIN
INSERT INTO Customers
SET Customers.CompanyName = inserted.CompanyName
END
Question 8: In SSIS, what is the difference between what is the difference between Control Flow and Data Flow? The difference between Synchronous and Asynchronous Data Flow Transformations?
A: Control Flow in SSIS processes tasks in either series or parallel, but does not move data. Data Flow consists of sources, transformations and destinations, and deals with the movement and manipulations of data as it is passed between components. Synchronous Data Flow Transformations process each row individually, while passing all rows from the input to the output buffer without change. Asynchronous Data Flow Transformations is required when there is a difference between the number of input and output rows, such as in a Merge or Aggregate transformation.
Question 9: In SSIS, what shape would you use to concatenate two input fields into a single output field?
A: The Derived Column Transformation allows for data from two separate columns to be concatenated into a single derived column.
Question 10: In SSRS describe a matrix report, and why you would use that format.
A: A matrix report is similar to a pivot table or crosstab report, in that it includes summaries for grouped data. A matrix report would be used when more detail is required than could easily be displayed with a table or list report.
Thanks again everyone!!!!