Question: Use the TSQLV4 database 1. The order id, order date, shipped date, and the shipto name and address for all orders that were shipped within

Use the TSQLV4 database

1. The order id, order date, shipped date, and the "shipto" name and address for all orders that were shipped within 5 days of receipt. Be careful about calculating the number of days between dates.

2. The employee number, full employee name (concatenated together) and number of orders taken by that employee during January and February 2016 for all employees. The list should be in descending order by the number of orders taken.

3. The names and addresses (address, city, region, postalcode & country concatenated together) of all customers who placed at least four orders during July or August of 2015.

4. The Supplier ID, supplier name and total cost of all products from that supplier that have been sold. Place the list in descending order by the amount sold. Do two versions of this query, one that shows all suppliers and one that only shows the top five suppliers.

-------------------------

SCHEMA:

Dbo.Nums Columns:n(PK, int, not null)

HR.Employees Columns:empid(PK, int, not null),

lastname(nvarchar(20), not null),

firstname(nvarchar(20), not null),

title(nvarchar(30), not null),

titleofcourtesy(nvarchar(25), not null),

birthdate(datetime, not null),

hiredate(datetime, not null),

address(nvarchar(60), not null),

city(nvarcha(15), not null),

region(nvarchar(15), null),

postalcode(nvarchar(5), null),

country(nvarchar(15), not null),

phone(nvarchar(24), not null),

mgrid(FK, int, null)

Production.Categories Columns:

categoryid(PK, int, not null),

categoryname(nvarchar(15), not null),

description(nvarchar(200), not null)

Production.Products Columns:

productid(PK, int, not null),

productname(nvarchar(40), not null),

supplierid(FK, int, not null),

categoryid(FK, int, not null),

unitprice(money, not null),

discontinued (bit, not null)

Production.Suppliers Columns:

supplierid (PK, int, not null),

companyname(nvarchar(40), not null),

contactname(nvarchar(30), not null),

contacttitle(nvarchar(30), not null),

address(nvarchar(60), not null),

city(nvarchar(15), not null),

region(nvarchar(15), not null),

postalcode(nvarchar(10), null),

country(nvarchar(15), not null),

phone(nvarchar(24), not null),

fax(nvarchar(24), null)

Sales.Customers Columns:

custid (PK,int, not null),

companyname(nvarchar(40), not null),

contacttitle(nvarchar(30), not null),

address(nvarchar(30), not null),

city(nvarchar(60), not null),

region(nvarchar(15), not null),

postalcode(nvarchar(10), null),

country(nvarchar(15), not null),

phone(nvarchar(24), not null),

fax(nvarchar(24) null)

Sales.OrderDetails Columns:

orderid (PK, FK, int, not null),

productid (PK, FK, int, not null),

unitprice(money, not null),

qty(smallint, not null),

discount(numeric(4,3), not null)

Sales.Orders Columns:

orderid (PK, FK, int, not null),

custid(FK, int, null),

empid(FK, int, not null),

orderdate(datetime, not null),

requireddate(datetime, not null),

shippeddate(datetime, null),

shipperid(FK, int, not null),

freight(money, not null),

shipname(nvarchar(40), not null),

shipaddress(nvarchar(60), not null),

shipcity(nvarchar(15), not null),

shipregion(nvarchar (15), null),

shippostalcode(nvarchar(10), null),

shipcountry(nvarchar(15), not null)

Sales.Shippers Columns:

shipperid (PK, FK, int, not null),

companyname (nvarchar(40), not null),

phone (nvarchar(24), not null)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!