0% found this document useful (0 votes)
2 views

Assignment3

The document outlines a series of SQL assignment tasks related to managing company finances using analytical tools. It includes queries for generating numbers, retrieving customer orders, and calculating order sums, utilizing various SQL JOIN operations and sorting methods. The tasks involve multiple tables from a database, focusing on customer and order data analysis.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Assignment3

The document outlines a series of SQL assignment tasks related to managing company finances using analytical tools. It includes queries for generating numbers, retrieving customer orders, and calculating order sums, utilizing various SQL JOIN operations and sorting methods. The tasks involve multiple tables from a database, focusing on customer and order data analysis.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Analytical tools for managing the company’s

finances. Assignment 3

Saint-Petersburg, 2025

1. There is a dbo.Digit table in the database that contains the numbers


0, 1, . . . , 9. Write a query that generates numbers from 0 to 999. In the
resulting query, the numbers must be sorted in descending order. Make
three different versions of this query:
a) using CROSS JOIN
b) using an INNER JOIN
c) using any of the JOINs, but generating numbers between 111 and
887 inclusive
2. The query should select all customers from Mexico and return for each of
them the number of orders placed and the total cost of the items ordered.
Sort in descending order of money spent. Use the tables Sales.Customers,
Sales.Orders and Sales.OrderDetails.
3. You need to get a list of customers with their orders. The result should
include even those customers who have not ordered anything. The tables
Sales.Customers and Sales.Orders are used.
4. Get a list of customers who placed orders on February 12, 2007. The result
should only include information from the table with customers. The tables
Sales.Customers and Sales.Orders are used.
5. There is a table in the TSQL2012 database that contains a list of orders.
Write a query that outputs full information about the orders that had a
minimum and maximum shipping cost (the freight field) in each country.
Use derived tables. Tables used: Sales.Orders.
6. There is a table in a TSQL2012 database that contains a list of orders.
Write a query that calculates for each customer the sum of his last 5 or-
ders. The sum should be calculated considering the discount. The final
result should display the customer ID, company name, contact person,
and the sum of the calculated orders. The result must be displayed in de-
scending order of calculated amounts. Tables involved: Sales.Customers,
Sales.Orders, Sales.OrderDetails.

1
7. The TSQL2012 database has tables that contain a list of customers and
suppliers. Write a query that displays customers and suppliers contact
persons and their phone numbers in the same list. Sort the list alphabet-
ically. Tables involveSales.Customers, Production.Suppliers.

You might also like