Please write queries based on the following requirements using WideWorldImporter
ID: 3725424 • Letter: P
Question
Please write queries based on the following requirements using WideWorldImporters Database
which is already installed on the SQL Server you used at class.
2. List the date of the first invoice sold by each employee (represented by
SalespersonPersonID). Show your results in ascending order on person full name
(Sales.Invoices and Application.People).
Explanation / Answer
select min(firstdate),fullname,id from wideworldimporters group by id.
Here we have given an aggregate function since we need to gather information of all employees who sold the product at the beginning.
Since we need it and we have to group them by their id which is unique and then we hav retrieved the minimum data from what they have sold which gives the result as the first data of their sale