1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vesna [10]
3 years ago
6

Create the following SQL Server queries that access the Northwind database. Place them in a zip file and place the zip file in t

he "drop box" for Assignment 5. Name the queries Query 1-MP5, Query2-MP5, etc. Note: These problems all require aggregate processing with GROUP BY
1. For each employee, list the employee ID, employee first name, employee last name, and count of orders taken in 1996. Place the list in descending order by the number of orders.
2. For all orders shipped in July or August, 1996, list the order ID, company name, order date, and total cost of all items ordered. Place the list in descending order by the total cost
3. For all customers from the USA, list the customer ID, company name, state, count of orders, and total order amount. Do not consider the discount. Place the list in order by state and then customer ID.
4. Same as problem 3 but limit the list to all customers who placed 3 or more orders.
5. For all items in the Grains/Cereals category, list the product ID, product name, supplier name, and last date that the product was ordered. Order the list by supplier name and product name (Hint: Use MAX and be sure to include all necessary tables)
6. The product ID, product name, and count of distinct customers who ordered that product in 1996. Place the list in descending order by the count of customers.
Computers and Technology
1 answer:
neonofarm [45]3 years ago
8 0

Answer:

1. SELECT e.EmployeeID, e.FirstName, e.LastName, COUNT(*) as OrderByEmployee FROM Employees e

JOIN Orders o

ON e.EmployeeID = o.EmployeeID

WHERE YEAR(o.OrderDate) = '1996'

GROUP BY e.EmployeeID,e.FirstName,e.LastName

ORDER BY OrderByEmployee DESC

2. SELECT o.OrderID,c.CustomerID, o.OrderDate,SUM((od.Quantity)*

od.UnitPrice - od.Discount)) as TotalCost FROM Orders o

JOIN [Order Details] od

ON od.OrderID = o.OrderID

JOIN Customers c

ON o.CustomerID = c.CustomerID

WHERE (MONTH(OrderDate)= 7 OR MONTH(OrderDate) = 8) and

YEAR(OrderDate) = 1996

GROUP BY o.OrderID,c.CustomerID, o.OrderDate

ORDER BY TotalCost DESC

3. SELECT c.CustomerID, c.CompanyName, c.City, COUNT(o.OrderID) as TotalOrder, SUM(od.Quantity* od.UnitPrice) as TotalOrderAmount FROM Customers c

JOIN Orders o

ON o.CustomerID = c.CustomerID

JOIN [Order Details] od

ON od.OrderID = o.OrderID

WHERE c.Country = 'USA'

GROUP BY c.CustomerID, c.CompanyName, c.City

ORDER BY c.City, c.CustomerID

4. SELECT c.CustomerID, c.CompanyName, c.City, COUNT(o.OrderID) as TotalOrder, SUM(od.Quantity* od.UnitPrice) as TotalOrderAmount FROM Customers c

JOIN Orders o

ON o.CustomerID = c.CustomerID

JOIN [Order Details] od

ON od.OrderID = o.OrderID

WHERE c.Country = 'USA'

GROUP BY c.CustomerID, c.CompanyName, c.City

HAVING COUNT(o.OrderID) > 3

ORDER BY c.City, c.CustomerID

5. SELECT p.ProductID, p.ProductName, s.ContactName as SupplierName, MAX(o.OrderDate) as LastOrderDateOfProduct FROM Products p

JOIN Categories c

ON c.CategoryID = p.CategoryID

JOIN Suppliers s

ON s.SupplierID = p.SupplierID

JOIN [Order Details] od

ON od.ProductID = p.ProductID

JOIN Orders o

ON o.OrderID = od.OrderID

where c.CategoryName = 'Grains/Cereals'

GROUP BY p.ProductID, p.ProductName, s.ContactName

ORDER BY SupplierName, p.ProductName

6. SELECT p.ProductID, p.ProductName, Count(DISTINCT c.CustomerID ) as OrderByThisManyDistinctCustomer

FROM Products p

JOIN [Order Details] od

ON od.ProductID = p.ProductID

JOIN Orders o

ON o.OrderID = od.OrderID

JOIN Customers c

ON c.CustomerID = o.CustomerID

where YEAR(o.OrderDate) = 1996

GROUP BY p.ProductID, p.ProductName

Explanation:

The six query statements returns data from the SQL server Northwind database. Note that all the return data are grouped together, this is done with the 'GROUP BY' Sql clause.

You might be interested in
Give reasons why mind-mapping software is important to project development.
Shtirlitz [24]

Answer:

Explanation:Mind mapping software can help you to make connections and become a better creative problem solver.

...

It helps you to make better decisions. ...

It helps you to become better organized. ...

You can see the forest and the trees. ...

It helps you to identify, prioritize and track key project tasks.

7 0
3 years ago
Salvado has a flash dish of is GB
exis [7]

Answer:

About 1,655 files or exactly 1655.646315789473684210526315785

1578

Source(s):

1.5 gb = 1,500 mb<---wrong right --->1536

Explanation:

6 0
3 years ago
What do the privacy settings on social networking sites actually control
scoundrel [369]

Answer:

 The privacy setting on the social networking site are important as it manage and also hide our all the privacy details. The social networking site are basically used for communication and also we can easily make connections with other people but sometimes we want to hide our personal details for security purpose from the strangers.

Then go the app and open the privacy setting button and change all the settings. We can also hide our status, last seen, personal information from the strangers as sometime people are selective with their audience.

5 0
4 years ago
A large organization with a large block address (12.44.184.0/21) is split into one medium size company using the block address (
Pepsi [2]

Answer:

The answer is explained below

Explanation:

The Organization mask is 21 so number of addresses granted to organization are 32 - 21 = 2048 addresses

Now, medium-size company has mask as 22 so number of addresses to medium-size organization are 32 - 22 = 1024 addresses

Each small organization has 32 - 23 = 512 addresses as mask is 23

That implies the range of addresses for each organization

Large Organization = 12.44.184.0/21 - 12.44.191.255/21

Medium organization = 12.44.184.0/22 - 12.44.187.255/22

small Organization 1: 12.44.188.0/23 - 12.44.189.255/23

small Organization 2: 12.44.190.0/23 - 12.44.181.255/23

so now if we have a router then we need to configure it so that when an address is routed correctly.

So router should be installed or configured for forward lookup which are defined in forwarding table

The forwarding table is configured o bases of longest prefix match

So Forward table will be:

00001100 00101100 10111110           small organization1

00001100 00101100 10111111           small organization2

00001100 00101100 1011110           medium-size organization

For each of them we can take an example in the range of its IP address and check this forwarding table  will correctly identify the other inner organizations

4 0
3 years ago
Which data storage or software tool is used to unify vast amounts of raw data of all types from across an organization
Korvikt [17]

A data lake is a type of repository that stores large sets of raw data of all types from across an organization.

<h2>What is a data lake?</h2>

A data lake is a central location in which to store all data, regardless of its source or format, for an organization at any scale.

<h3>Characteristics of a data lake</h3>

  • It is low cost, easily scalable, and are often used with applied machine learning analytics.

  • It allows to import any type of data from multiple sources in its native format, this allows organizations to scale in the size of the data as needed.

Therefore, we can conclude data lakes are a vital component in data management as it stores all data across an organization.

Learn more about data lakes here: brainly.com/question/23182700

4 0
3 years ago
Other questions:
  • Describe a function that would take in any RGB value and double its intensity. What do you think happens if the input is 200, 22
    8·1 answer
  • Technology can most broadly be defined as anything that does which of the following ?
    11·1 answer
  • A ____ is a workbook that you can open with the text, formats, and formulas already built into it.
    14·2 answers
  • DSSS uses a chipping code to encode redundant data into the modulated signal. Which two of the following are examples of chippin
    12·1 answer
  • 4. Which network infrastructure provides access to users and end devices in a small geographical area, which is typically a netw
    15·1 answer
  • Which of the following is NOT a possible duty for a professional working in the Web and Digital Communications pathway?
    7·1 answer
  • Identify a true statement to determine the number of columns in a web table.
    7·1 answer
  • What is the most popular type or method of guaranteed reservation where booking transactions will be charged automatically?
    7·1 answer
  • When right-clicking an object, a ____ menu appears, which contains frequently used commands related to the object.
    7·1 answer
  • Software piracy can be described as
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!