Question: Q . Write a SQL query to select information from the Sales table. Sales table has following attributes: ( Sales _ No , Product _

Q.Write a SQL query to select information from the Sales table. Sales table has following attributes:
(Sales_No, Product_name, Branch, Sales_ amount,salesperson_name, DOB)
Calculate total sales amount in each branch.
Calculate the average sales amount in each branch.
Display all the salesmen, DOB who are born in the month of December as day in character format i.e. YYYY-MM-DD.
Display the name and DOB of salesman in alphabetical order of the month
Instruction
.1.Write a SQL query to calculate the total sales amount for each branch . The query should;
Sum the sales amount from the sales table.
Group the results by branch id and branch to get the total_sales for each branch.
The output should include the branch_id and branch and the corresponding total_sales
2. Write a SQL query to calculate the average sales amount for each branch. The query should:
Calculate the average of the sales_amount from the sales table.
Group the results by branch_id and Branch to get the average_sales for each branch.
The output should include the branch_Id and Branch and the corresponding average_sales.3. Witte a SQL query to retrieve the name and date_of_birth of all salesmen born in December. The query should :
Select the name and date of birth columns from the salesmen table.
Filter the results to Include only those salesmen whose date_of_birth falls in the month of December.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!