HOMEWORK for Quicksoultionz4u

profileade68
itco331_ass_1-_5.docx

Unit1 - Individual Project

close

Your first task is to download and install SQL Server 2008, Express Edition. Once that is installed, set up the Northwind database, which will be used throughout the class.

Complete the following tasks:

· Download and install SQL Server 2008, Express Edition.

· Refer to Appendix A of the textbook.

· Open and run the attached script to create the Northwind database.

· To download the script, click here.

· Create the following tables in the Northwind database:

· Regions table

· Column Name

· Datatype

· Primary Key (Y/N)

· Nullable (Y/N)

· RegionID

· Integer

· Y

· N

· RegionDescription

· Character (50)

· N

· N

· Departments table

· Column Name

· Datatype

· Primary Key (Y/N)

· Nullable (Y/N)

· DepartmentID

· Integer

· Y

· N

· DepartmentDescription

· Character (50)

· N

· N

· Insert the following data into the 2 tables:

· Regions table

· 1

· Eastern

· 2

· Western

· 3

· Northern

· 4

· Southern

· Departments table

· 10

· CEO

· 20

· Sales

· 30

· Marketing

· Alter the Employees table, and add a column:

· Employees table

· Column Name

· Datatype

· Primary Key (Y/N)

· Nullable (Y/N)

· DepartmentID

· Integer

· N

· Y

· Alter the Employee table to establish a foreign key between Employees and Departments.

· Employees.DepartmentID references Departments.DepartmentID

· Alter the Territories table to establish a foreign key between Territories and Regions.

· Territories.RegionID references Regions.RegionID

· Update the data in the Employees table so that employees with the following managers are listed as working in the following departments:

· ReportsTo

· Department

· Andrew Fuller

· Sales

· Steven Buchanan

· Marketing

· All Others

· CEO

Submit the SQL, DDL, and DML scripts needed to complete tasks 2–8 and a database diagram of the final database.

Unit2 - Individual Project

Using the Northwind database, write a SQL SELECT statement that will retrieve the data for the following questions:

· Display the character constant 'Greeting' with a column heading of 'Hello.'

· 1 row returned.

· Display all data from the categories tables without specifying the names of the table columns. Order the results by CategoryName.

· 8 rows returned.

· Display all employees' names, last name first, and then first name, hire date and home phone number. Order the results by employee name, last name first, and then first name.

· 9 rows returned.

· Modify query 3 so that the column headings are as follows: 'Last Name,' 'First Name,' 'Date of Hire,' and 'Home Phone Number.'

· 9 rows returned.

· Display the product name and quantity per unit, units in stock, and unit price for all products that have a unit price greater than $50. Order the results by unit price in descending order.

· 7 rows returned

· Display the Name of all U.S.-based suppliers. Order the results by Name in ascending order.

· 4 rows returned.

· Display the Order Id, ShipName, Order Date, and Freight of all orders that have a freight >/= 50 and </= 100; a ship country of Austria, Brazil, or France; and a Ship City that starts with an 'S.' Use, BETWEEN, IN, and LIKE for the WHERE clause conditions. Order the results by ShipName in ascending order.

· 13 rows returned.

· Rewrite query 7 to remove the use of BETWEEN and IN, and replace with the equivalent use of =, <, >, </=, >/= and AND and OR expressions.

· 13 rows returned.

· Select the Employee's First Name, concatenated to the Last name, separated by a space. Call the column 'Employee Name,' the length of this employee name Length, the location of the first 'a' in the name 'A Location,' and the 5–9 characters from the name 'Substring.' Order the results by the Employee Name using the alias.

· 9 rows returned.

· For each customer, show the number of orders placed, and the largest, smallest and total freight ordered. Only show those customers who have placed more than 15 orders.

9 rows returned.

Unit3 - Individual Project

Write SQL statements that will retrieve the following data from a database, using Subqueries and Joins. Using the Northwind database, write a SQL SELECT statement that will retrieve the data for the following questions:

· For each order, display the Company Name, City, and the Country for the customer who placed the order.

· Include the Order Date and the Required Date. Order the results by Company Name in ascending order.

· 830 rows returned.

· For each order, list the OrderID, Orderdate, Product Name, UnitPrice, Quantity Ordered, and Total Cost. Label the column 'Product Cost.'

· For each product (including the discount), only show those orders that were placed in March of 1997.

· Sort the data by the OrderID, then the Product Name.

· 77 rows returned.

· For each order, display the OrderID, ShipName, and the Employee First and Last Name.

· Order the results by Employee Last Name in descending order, then by Employee First Name in ascending Order, then by OrderID in ascending order.

· 830 rows returned.

· Modify the first query to list the orders with customer details, but include all customers even if they have not placed an order.

· 832 rows returned.

· List all customers (include CustomerId and Company Name) who have placed less than 5 orders.

· Include those customers who have placed 0 orders. Name the count field "OrderCount."

· Order by number of placed orders in reverse order.

· 18 rows returned.

· Display the ProductName, and UnitPrice of all products that have a unit price larger than Tarte au Sucre.

· Order the results by UnitPrice in descending order.

· 7 rows returned.

· Display the Customer Name of all customers who have placed orders in 1996.

· Order the results by Company Name in ascending order.

· 67 rows returned.

· Display the OrderID of all orders that where placed after all orders placed by Bottom-Dollar Markets.

· Order the result by OrderID in ascending order.

· 28 rows returned.

· List the Company Name of all U.S.-based customers who are NOT located in the same state (or region) as any of the employees.

· Order the results by Company Name.

· 10 rows returned.

· Display the Product Names of all products that were placed by customers in CA.

· Order the result by Product Name in ascending order.

· Eliminate duplicate rows in the results.

10 Rows Returned.

Unit4 - Individual Project

You are hired by Northwind as a Database administrator. You are required to integrate some Database script solutions into their existing database (Northwind) to modify data from within the database.

Using the Northwind database, write a SQL DML statement that will modify the data. Base it on the following requirements:

· Using the Northwind database, write a script to insert the following data:

· 1 new Category

· Category Name = Fast Food

· Category Description = Quick and Easy Meals

· Provide a SELECT statement to show that the data was inserted.

· Add the following products for your new Fast-Food category.

· Product Name = French Fries

· Supplier Name = Ma Maison

· Category Name = Fast Food

· QuantityPerUnit = 20 Sticks

· UnitPrice = 4.99

· UnitsInStock = 10

· UnitsOnOrder = 25

· ReorderLevel = 10

· Disabled = 0

· Product Name = Hamburger

· Supplier Name = Grandma Kelly's Homestead

· Category Name = Fast Food

· QuantityPerUnit = 1 Patty

· Unit Price 6.99

· UnitsInStock = 0

· UnitsOnOrder = 50

· ReorderLevel = 5

· Disabled = 0

· Provide a SELECT statement to show that the data was inserted.

· In an attempt to liquidate some products, provide a script to set all products in the Confections category that have more than 50 units in stock to a price of $10, and disable them.

· 2 records should be affected.

· Change the discount in the Order Details table on all orders of products of an ordered quantity of more than 50 to that of the largest discount ever given on any product.

· 159 records should be affected

· You have decided against the new Fast-Food category. Provide a SQL statement to delete the Fast-Food category as well as any products assigned to that category.

This assignment will also be assessed using additional criteria provided here .

Unit5 - Individual Project

As you approach the end of the class, you have seen how a database can be set up and accessed. Next, you will look at various applications that could utilize a database. Choose 1 of the database applications or implementations below:

· Knowledge management

· Data warehousing

· Data mining

· Digital libraries

· Object-oriented databases

Write a paper that describes the topic in detail. Include a discussion on the following subject areas:

· History or background

· Database and DBMS requirements

· Database or schema object considerations and design implications

· Considerations to integrate the database application into an existing system

Real-world examples of an implementation