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

Assignment2

The document outlines a series of assignments related to TSQL2012 database queries for managing company finances. It includes tasks such as creating mailing addresses for suppliers, splitting customer names, calculating employee ages, converting student grades, counting discounted order items, and identifying shipping countries for orders. Each task specifies the relevant tables and required SQL functions to be used.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Assignment2

The document outlines a series of assignments related to TSQL2012 database queries for managing company finances. It includes tasks such as creating mailing addresses for suppliers, splitting customer names, calculating employee ages, converting student grades, counting discounted order items, and identifying shipping countries for orders. Each task specifies the relevant tables and required SQL functions to be used.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Analytical tools for managing the company’s

finances. Assignment 2

Saint-Petersburg, 2025

1. There is a table in a TSQL2012 database that contains a list of supplier


companies. Write a query that makes a complete mailing address for each
company, consisting of the fields postalcode, county, region, city, address in
the listed sequence. Use a space character as a separator. Tables involved:
Production.Suppliers

2. There is a table in a TSQL2012 database that contains a list of customers.


Write a query that splits the name specified in the contractname field into
two parts. The separator used is ",". There is a CHARINDEX function in
T-SQL to search for a substring in a string. Use LTRIM, RTRIM functions
to remove unnecessary end spaces. Tables involved: Sales.Customers.
https://docs.microsoft.com/en-us/sql/t-sql/functions/charindex-transact-sql?
view=sql-server-ver15
3. There is a table in a TSQL2012 database that contains a list of employees.
Write a query that calculates the age of each employee in the current year.
Tables involved: Hr.Employees.

4. There is a table in the TSQL2012 database that contains the scores (values
from 0 to 100) received by students in exams. Write a query that converts
the grades received by students from a system of 0 to 100 to a system of
0 to 1 (0 if the score is less than 60, 1 if the score is greater than or equal
to 60). Tables involved: Stats.Scores

5. TSQL2012 database has a table that contains order items. Write a query
that calculates for each order the number of items with a discount, print
the result in descending order of the number of items with a discount.
Tables involved: Sales.OrderDetails.
6. There is a table in a TSQL2012 database that contains a list of orders.
Write a query that determines which countries the orders were shipped
to. Sort the result alphabetically. Tables involved: Sales.Orders.

You might also like