Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DBS 3 1 1 Advanced Data Services Last update: Summer 2 0 2 4 Advanced Databae Services Assignment 1 SubmissionYour submission will be a single
DBS Advanced Data Services Last update: Summer Advanced Databae Services Assignment SubmissionYour submission will be a single textbased SQL file sql with appropriate header and commenting. Please ensure your file runs when the entire file is executed in SQL Developer. A submission format filesql is provided, you can fill your code in this format file. Name your submission file as AGroup#sqlMake sure only one submission per group.Style GuideYour SQL should be written using the standard coding style: all keywords are to be upper case, all userdefined names are to be lower case, example: table and field names there should be a carriage return before each major part of the SQL statements ie before SELECT,FROM, WHERE and ORDER BY See the following sample:SELECT columnsFROM tablesWHERE conditionsORDER BY columncolumn;Submission ChecklistUse the following checklist, to make sure you have completed the assignment successfully. Tasks to be completedYou have read the assignment group submission and completion policies and all instructions provided in the assignment document and have not missed a word. Student information and the assignment information have been added to the header of the submission. Same as the template provided in the assignment documentsAll questions are answered in a text file a SQL worksheet and are saved as a sql file.Comments are included. questions definition or any additional explanation All SQL statements are executed successfully without errors. Use "Run Script" to execute all statements together.Group WorkYes No This assignment is to be completed in groups of Please only one submission per group. The comment header MUST have all students name and student number.It is suggested that you ALL do it individually and then meet to compare answers. Those not doing the work may be barred from your group resulting in a zero and incomplete on the assignment. PageDBS Advanced Data ServicesLast update: Summer Assignment Marking Scheme Question Weight Question Weight VERY IMPORTANT:Being part of a group is the same as being a part of a team for these assignments. When you submitted your work as part of a group, you are saying that: You understood what was submitted and that you fully participated with ALL the group members. It does not mean letting others do your work for you. It does not mean watching the others do the work. For your full participation, you get a mark equal to all the others in the group. If on the test, which is very much like the assignment, you cannot answer it strongly indicates that you did not participate and understand the assignment but depended on others for the mark you received. That is very much like submitting their work and claiming it is your work.Example Submission a submission format file is provided Student Name: member Name Student ID: ######### Student Name: member Name Student ID: ######### Student Name: member Name Student ID: ######### Date: The date of assignment completion Purpose: Assignment DBS Question write a brief note about what the question is asking Q SOLUTION SELECT orderid AS "order id COUNTitemid AS "number of items" FROM orderitemsWHERE orderid GROUP BY orderidORDER BY orderid;order id number of items PageDBS Advanced Data Services Last update: Summer TasksFor each question, the columns title and the format of the output result must match the sample output columns given in that question.In your sql file, include the SQL query and the output result for each question. Put your output result in a comment block HiredWrite a query to display employee ID first name, last name, and hire date for employees who have been hired on weekendsSaturday and Sunday and after the th week of Hint: remember to avoid the format difference brought by date language settings. The query returns rows.See the output columns:EMPLOYEEID FIRSTNAME LASTNAME HIREDATE Only One EmployeeDisplay manager ID for managers who has only one direct employee. Answer this question use Set Operators, do not use the COUNT function.Sort the result by manager IDThe query returns rows. See the output columns: Manager ID Indirect EmployeeDisplay manager ID for managers who have indirect employees. For example, the manager of employee is employee whose manager is employee then employee has indirect employeesSort the result by manager IDThe query returns rows. See the output columns: Manager ID PageDBS Advanced Data Services Last update: Summer SubscriptionIf a customer bought the same product again on the th days later, we consider this as subscription. Write a query to find customers who have subscription products. Display the customer id and product id Sort the result by customer idThe query returns rows. See the output columns:Customer ID Product ID Frequent Ordered ProductsWrite a SQL query to display products that have been ordered multiple times in different orders on the same day in Display product ID order date, and the number of times the product has been ordered on that day.Sort the result by order date and product IDThe query returns rows. See the following output columns:Product ID Order Date Number of orders PreferredIf a customer buys over different products from the same category, we consider it is a preferred category to this customer.Write a query to display customer ID and customer name for customers who have exactly preferred categories.Sort the result by customer IDThe query returns rows. See the following output columns: CUSTOMER ID NAME FavouriteThe category from which the customer bought the most kinds of products is called the favourite category of that customer. Write a query to find the customers who have more than one favourite categories. Display the customer ID and the category ID only for those who bought over kinds of product.The query returns row. See the following output: Month NumberPageDBS Advanced Data Services Last update: Summer Order AmountWrite a query to display the month number, month name, year, total number of orders, and total sales amount for each month in Sort the result according to month number.The query returns rows. See the output result as follows. Month Number Month Year Total Number of Orders Sales Amount February May June July August September October November December Monthly AverageWrite a query to display month number, month name, and average sales amount per order for each month in where the average sales amount is greater than the average sales amount per order for the entire year.Round the average amount to two decimal places.Sort the result by the month number.HINT: In this query, you will calculate the average sales amount for each month in and compare it tothe overall average sales amount for the entire year. Using a WITH clause will simplify your code greatly. The query returns rows. See the output result as follows: Month Number Month Average Sales Amount May June July August NovemberPageDBS Advanced Data Services Last update: Summer CalculationWrite a query to generate the following output with the calculated values filled inAverage order amount is the average amount during salesman. While calculating the average order amount, you should exclude the orders that without a salesman.Hint: Using a WITH clause will simplify your code.GOOD LUCK! OUTPUT The number of employees with total order amount over average order amount: xThe number of employees with total number of orders greater than : xThe number of employees with no order: xxThe number of employees with orders: x Page
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started