SQL review with JOINS using Northwinds Ex (1)

SQL review with JOINS using Northwinds Ex (1) - 1. Select...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1. Select Orders.OrderID, Orders.CustomerID, Orders.Freight From Northwinds.Orders Where Orders.Freight between 600 AND 700 2 Select Orders.OrderID, Orders.CustomerID, Orders.ShippedDate From Northwinds.Orders Where Orders.ShipPostalCode='5020' OR Orders.ShipPostalCode='5022' Order by CustomerID, OrderDate 3 Select Count(*) AS NumberOfOrder From Northwinds.Orders Where Orders.ShipPostalCode='5020' OR Orders.ShipPostalCode='5022' 4 Select Orders.OrderID, Orders.CustomerID,Orders.EmployeeID,Orders.ShippedDate,Orders.ShipCity, Orders.ShipCountry From Northwinds.Orders Where Orders.EmployeeID=4 AND (Orders.ShipPostalCode='5020' Or Orders.ShipPostalCode='5022') Order By ShippedDate DESC 6 records 5 Select Orders.OrderID, Customers.CompanyName,Employees.lastName,Employees.FirstName,Orders.ShippedDate,Ord ers.ShipCity, Orders.ShipCountry From Northwinds.Orders,Northwinds.Customers,Northwinds.Employees Where Employees.EmployeeID=Orders.EmployeeID AND Orders.CustomerID=Customers.CustomerID AND Orders.EmployeeID=4 AND (Orders.ShipPostalCode='5020' Or Orders.ShipPostalCode='5022') Order By ShippedDate DESC 6. Select ShipPostalCode,To_char(Orders.ShippedDate, 'YYYY'), Count(OrderID), Avg(Freight) From Northwinds.Orders Where ShipPostalCode='5020' OR ShipPostalCode='5022' Group BY ShipPostalCode, To_char(Orders.ShippedDate, 'YYYY') Order By To_char(Orders.ShippedDate, 'YYYY') DESC 7 Select Sum(OrderDetails.UnitPrice*OrderDetails.Quantity) AS TotalCostSelect Sum(OrderDetails....
View Full Document

This note was uploaded on 04/01/2012 for the course MIS 245 taught by Professor Havelka during the Spring '12 term at Miami University.

Page1 / 4

SQL review with JOINS using Northwinds Ex (1) - 1. Select...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online