Consider the following three tables, primary and foreign keys Table Name SalesPe
ID: 3723952 • Letter: C
Question
Consider the following three tables, primary and foreign keys Table Name SalesPeople Attribute Name EmployeeNumber Name JobTitle Address PhoneNumber YearsInPosition Type Number Character Character Character Characteir Number Key Type Primary Key Table Name ProductDescription Attribute Name Type Number Key Type Primary Key ProductNumber ProductName ProductPrice Character Number Table Name SalesOrder Attribute Name SalesOrderNumber ProductNumber EmployeeNumber SalesOrderDate Type Number Number Number Date Key Type Primary Key Foreign Key Foreign Key Assume that you draw up a new sales order for each product sold. Develop the following queries and submit them as a picture or document All the Sales People with less than three years in position who have sold Product Number 1167. (3 pts) All the Products with the word "bracket" in the Product Name. (3 pts) All the Sales Orders for products with a price of more than $33. (3 pts) a. b. c.Explanation / Answer
Answer:
a)Select sp.EmployeeNumber,sp.Name,sp.YearsInPosition,pd.ProductNumber
from SalesPeople sp join Salesorder so on so.EmployeeNumber = sp.EmployeeNumber
join ProductDescription pd on pd.ProductNumber = so.ProductNumber
where pd.ProductNumber =='1167' and
sp.YearsInPosition < '3'
group by sp.EmployeeNumber,pd.ProductNumber
/*This query will display all sales people with less than 3 years in postion who have sold Product Number 1167 */
b) select * from ProductDescription where ProductName like "%bracket%"/*This query will list all products with the Product name bracket in it*/
c)select so.SalesOrderNumber, so.SalesOrderDate,pd.ProductPrice
from SalesOrder so join ProductDescription pd on pd.ProductNumber = so.ProductNumber
where pd.ProductPrice > '33'
group by so.SalesOrderNumber /*This query will display the reults of all sales order numbers and date where product price more than 33*/
Let me know in comments if you have any doubts in the queries.