Analytical tools for managing the company’s
finances. Assignment 1
Saint-Petersburg, 2025
1. Return information about orders (orderid, orderdate, custid, empid fields)
placed in June 2007. The table used: [Link]. Note - To record that
some order was placed, say, no later than November 6, 2018, use the
following format
orderdate<='2018-11-06'
similarly for dates the operators <, >, >=, =, <> (the "not equal"operator)
are used
2. Return information about orders (orderid, orderdate, custid, empid fields)
placed on the last day of the month . The table being used: [Link].
Note: T-SQL (a dialect of SQL used in Microsoft SQL Server) has a
function EOMONTH that takes the date as input and returns the date
corresponding to the end of the month.
3. Make a table (use "select ... from (values ..)") with information about
the days of the week (serial number and name of the day). Output the
information about even days only, ordering the rows by number.
4. Return the order identifiers (orderid field) whose total value (totalvalue
field, which should be calculated as the sum of qty*unitprice) exceeds
10000, sort the result by total value. The table used: [Link].
Note: Use the function SUM to find the amount.
5. Return the three countries (shipcountry field), the average cost of shipping
orders (avgfreight, calculated as the average of the freight field) to which
was the highest in 2007. Table used: [Link]. Note: To find the
average, use the function AVG.