
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question

Transcribed Image Text:dwcustomer
CUS_CODE INT(11)
CUS_LNAME VARCHAR(15)
CUS_FNAME VARCHAR(15)
CUS INITIAL CHAR (1)
CUS_STATE CHAR(2)
OREG_ID INT(11)
Indexes
dwdaysalesfact
TM_ID INT (11)
CUS_CODE INT(11)
P_CODE VARCHAR(10)
SALE UNITS INT (11)
SALE PRICE DECIMAL (10,2)
Indexes
1
1
dwregion
REG_ID INT(11)
OREG_NAME VARCHAR(10)
Indexes
dwtime
TM_ID INT (11)
TM_YEAR INT(11)
TM_MONTH INT (11)
TM_DAY INT (11)
TM_QTR INT(11)
Indexes
dwproduct
PP_CODE VARCHAR (10)
OP_DESCRIPT VARCHAR(35)
OP_CATEGORY VARCHAR(5)
OV_CODE INT (11)
Indexes
dwvendor
PV_CODE INT (11)
OV NAME VARCHAR(35)
OV_AREACODE CHAR(3)
OV_STATE CHAR(2)
Indexes

Transcribed Image Text:Using Group By with Rollup, write & run the SQL command using MySQL workbench to list the total sales by customer, month and product, with subtotals by customer and by month and a grand
total for all product sales. Scroll the results to the bottom to show the GRAND TOTAL and the PREVIOUS SUB-TOTAL. Use the image below as a reference for a correct solution.
CUS_CODE TM_MONTH
10018
10018
10018
10018
10018
10018
10019
10019
10019
9
9
9
9
9
HALL
J
9
9
Ć
HALL
P_CODE
2238/QPD 38.95
23109-HB 9.95
54778-2T 9.98
PVC23DRT 70.44
129.32
129.32
1546-QQ2 39.95
39.95
39.95
2252.06
NULL
HULL
Total
Sales
HALL
MILL
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- I need help with the SQL query for the following question: 1. Get a list of 10 product reviews that got review rating 5 and price more than thousand. Here is the information on the field names: The table name is: Reviews Review Form Fields Product/ModelName: Product/Category: Product/Price: Retailer/Name: Retailer/ZipCode: Retailer/City: Retailer/State: Product/On Sale: Manufacturer/Name: Manufacturer/Rebate: Review/UserId: Review/Rating: Review/Date: Review/Text: Example of Review Form Filled out ProductModelName: Galaxy S4 ProductCategory: Smart Phone ProductPrice: 499 RetailerName: Bestbuy RetailerZipCode: 44114 RetailerCity: Cleveland RetailerState: OH ProductOnSale: No ManufacturerName: Samsung ManufacturerRebate: No ReviewUserId: xmm473 ReviewRating: 3 ReviewDate: 6/10/2012 ReviewText: overheats after 2 hoursarrow_forwardWrite a sample SQL query to look at data by week for the created_at date, where you're summing revenue by country and state.arrow_forwardTask 2: The Driver Relationship team wants to arrange workshops and education materials to the drivers. However, the team wants to create clusters of the drivers based on their experience in InstantStay. To collect these detail, you will need to create a SQL function called DRIVER_STATUS to determine the level of the driver as follows: MASTER: more than 4 travels PRO: more than 2 travels ROOKIE: 2 or less travels In addition, run the function to verify it works as expected and send them back the driver levels. SQL Database Test: SELECT DRIVER_ID, DRIVER_STATUS(DRIVER_ID) FROM DRIVERS Create the DRIVER_STATUS function Expected Results: DRIVER_ID DRIVER_STATUS(DRIVER_ID) 2001 MASTER 2002 ROOKIE 2003 PRO 2004 ROOKIE 2005 ROOKIEarrow_forward
- With SQL code, find the name of each employee with a manager along with their manager's name (use cartesian product and rename) Employee table: create table employee( ID varchar(6) not null,person_name varchar(10),street varchar(10),city varchar(10),primary key (ID)); Manages table: create table manages(ID varchar(6) not null,manager_id varchar(6),primary key (ID),foreign key (ID) references employee,foreign key (manager_id) references employee);arrow_forwardHow do I make space on the Header on SQL? please see image.Thank you. SELECT BRAND_NAME, BRAND_TYPE, round(AVERAGE,2) AS 'Average Price', UnitsSoldFROM (LGBRAND INNER JOIN (SELECT BRAND_ID, AVG(PROD_PRICE) AS AVERAGE FROM LGPRODUCT GROUP BY BRAND_ID) AS SUB1 ON LGBRAND.BRAND_ID = SUB1.BRAND_ID) INNER JOIN (SELECT BRAND_ID, SUM(LINE_QTY) AS UNITSSOLD FROM LGPRODUCT INNER JOIN LGLINE ON LGPRODUCT.PROD_SKU = LGLINE.PROD_SKU GROUP BY BRAND_ID) AS SUB2 ON LGBRAND.BRAND_ID = SUB2.BRAND_IDORDER BY BRAND_NAMEarrow_forwardGiven the table PRODUCT(ProductID, ProductName, ProductClass, ProductWeight, ProductStyle, ProductColor, ProductPrice). Note: ProductWeight and ProductPrice are numeric fields, and the other attributes are character fields, i.e., store text. Write a SQL query to retrieve the product name and price whose weight is between 15.0 (inclusive) and 20.0 (inclusive) and whose style is "Modern".arrow_forward
- In Visual basics explain the meaning of the listed SQL commands : (a)ORDER BY (b)INNER JOIN (c)INSERT (d) ALTER TABLEarrow_forwardI need help with this SQL query: Write a MySQL statement to create a table named jobs including columns job_id, job_title, min_salary and max_salary, and check whether the min_salary amount is lower than the lower limit $15,000 and whether the max_salary amount exceeds the upper limit $50,000.arrow_forwardWrite following SQL Queries:1. List the order number, order date, customer number, customer name (first and last), employee number, and employeename (first and last) of January 2017 orders placed by Colorado customers.2. List the customer number, name (first and last), order number, order date, employee number, employee name (first andlast), product number, product name, and order cost (OrdLine.Qty * ProdPrice) for products ordered on January 23,2017, in which the order cost exceeds $150.3. List the order number and total amount for orders placed on January 23, 2017. The total amount of an order is the sumof the quantity times the product price of each product on the order.4. List the order number, order date, customer name (first and last), and total amount for orders placed on January 23,2017. The total amount of an order is the sum of the quantity times the product price of each product on the order.arrow_forward
- I need help with the SQL query for the following question: 1. Get a list of 5 reviews for shoppers in Chicago Here is the information on the field names: The table name is: Reviews Review Form Fields Product/ModelName: Product/Category: Product/Price: Retailer/Name: Retailer/ZipCode: Retailer/City: Retailer/State: Product/On Sale: Manufacturer/Name: Manufacturer/Rebate: Review/UserId: Review/Rating: Review/Date: Review/Text: Example of Review Form Filled out ProductModelName: Galaxy S4 ProductCategory: Smart Phone ProductPrice: 499 RetailerName: Bestbuy RetailerZipCode: 44114 RetailerCity: Cleveland RetailerState: OH ProductOnSale: No ManufacturerName: Samsung ManufacturerRebate: No ReviewUserId: xmm473 ReviewRating: 3 ReviewDate: 6/10/2012 ReviewText: overheats after 2 hoursarrow_forwardGiven the table PRODUCT(ProductID, ProductName, ProductClass, ProductWeight, ProductStyle, ProductColor, ProductPrice). Note: ProductWeight and ProductPrice are numeric fields, and the other attributes are character fields, i.e., store text. Write a SQL query to display the product class whose average price is at least 50arrow_forwardBased on SQL informationarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education