
Table structure:
administrators = admin_id, email_address, password, first_name, last_name
categories = category_id, category_name
customers = customer_id, email_address, password, first_name, last_name, shipping_address_id, billing_address_id
order_items = item_id, order_id, product_id, item_price, discount_amount, quantity
orders = order_id, customer_id, order_date, ship_amount, tax_amount, ship_date, ship_address_id, card_type, card_number, card_expires, billing_address_id
products = product_id, category_id, product_code, product_name, description, list_price, discount_percent, date_added
5.
SELECT email_address, REGEXP_SUBSTR(email_address, '([^@]+)') AS
"user_name", REGEXP_SUBSTR(email_address, '([^@]+[a-z]*$)') AS
"domain_name" FROM administrators;
6.
SELECT product_name, SUM(quantity) AS total_quantity, RANK() OVER (ORDER BY total_quantity DESC) rank, DENSE_RANK () OVER (ORDER BY total_quantity DESC) dense_rank FROM Products , Order_Items WHERE Products.product_id = Order_Items.product_id GROUP BY Order_Items.product_id
7.
SELECT `product_name`, categories.category_id, `category_name`, SUM(`quantity`) AS total_quantity, FIRST_VALUE(`category_name`) OVER ( PARTITION BY `category_id` ORDER BY total_quantity DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) highest_sales, LAST_VALUE(`category_name`) OVER ( PARTITION BY `category_id` ORDER BY `total_quantity` DESC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) lowest_sales FROM `Products` , `Order_Items`, `Categories` WHERE Products.product_id = Order_Items.product_id and products.category_id = categories.category_id GROUP BY Order_Items.product_id;
Table structure: administrators = admin_id, email_address, password, first_name, last_name categories = category_id, category_name customers = customer_id,...
Figure 3-4 Sample Schema co CO PRODUCTS CUSTOMERS product_id customer_id product_name email_address unit_price full_name product_details product_image image_mime_type image_charset image_filename image_last_updated ORDER_ITEMS order_id line_item_id product_id unit_price quantity ORDERS order_id order_datetime customer_id order_status store_id STORES store_id store_name web_address physical address latitude longitude logo logo_mime_type logo_charset logo_filename logo_last_updated | 3. Write one SELECT statement to display ten most popular products (only ten rows) in 2018. The most popular means the highest quantity ordered on COMPLETED orders. Display the product id, product name, and...
Write a SELECT statement that answers this question: What is the total quantity purchased for each instrument within each category? Return these columns: The category_name column from the category table The instrument_name column from the instruments table The total quantity purchased for each instrument with orders in the order_instruments table Use the WITH ROLLUP operator to include rows that give a summary for each category name as well as a row that gives the grand total. Use the IF and...
Using the below Relational Design from Oracle SQL data modeler,
provide sql script for the following queries (note please be sure
to include "PART3.Table_name" when pulling info from specific
tables)
Query 6: How many orders are there by customer and what is the
total sales and total profit sorted by customer’s total number of
orders?
Query 15: What is the total number of orders by shipping
class?
Query16: What are the monthly total sales from 2013 to 2014?
Query 17:...
#6 Write a SELECT statement that returns these columns: The count of the number of orders in the Orders table The sum of the tax_amount columns in the Orders table Write a SELECT statement that returns one row for each category that has products with these columns: The category_name column from the Categories table The count of the products in the Products table The list price of the most expensive product in the Products table Sort the result set so...
DROP TABLE IF EXISTS customers; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS order_details; DROP TABLE IF EXISTS items; DROP TABLE IF EXISTS artists; DROP TABLE IF EXISTS employees; -- create tables CREATE TABLE customers ( customer_id INT , customer_first_name VARCHAR(20), customer_last_name VARCHAR(20) NOT NULL, customer_address VARCHAR(50) NOT NULL, customer_city VARCHAR(20) NOT NULL, customer_state CHAR(2) NOT NULL, customer_zip CHAR(5) NOT NULL, customer_phone CHAR(10) NOT NULL, customer_fax CHAR(10), CONSTRAINT customers_pk...
ERD and Schema for the model is:CUSTOMER ( ID, Lname, Fname, Street, City, ZipCode, State, Phone, CreditScore, Credit_Org, CS_Date)PLAN ( Plan_ID, Start_Date, End_Date, BasePrice, Plan_Type)VOICE ( vPlan_ID@, NumMin, HasVoiceMail, HasThreeWay, OverageFee)TEXT ( tPlan_ID@, TextLimit, HasMMS, MmsOverage, TextOverage)DATA ( dPlan_ID@, DataLimit, NetworkTechnology, OverageFee)CONTRACT ( Contract_ID, Customer_ID@, vPlan_ID@, tPlan_ID@, dPlan_ID@, Start_Date, End_Date, DiscountPerc)MANUFACTURER ( Manuf_ID, Manuf_Name, Contact_Lname, Contact_Fname, Contact_Phone, Contact_Email)PRODUCT ( Product_ID, Name, Manuf_ID@, CostPaid, BasePrice, Type)CELLPHONE ( Phone_ID@, Model, NetworkTechnology, OS)ACCESSORY ( Access_ID@, Category)PHONE_ACCESS ( Phone_ID@, Access_ID@)CONTRACT_CELLPHONE ( Contract_ID@, Phone_ID@, Seq#, PaidPrice, ESN)1. CellTell would like to add website information about the manufacturers of products they sell. Add a new column named “Website” to the manufacturer table. Then,...
Create a procedure to update the sales history table following the requirements below. A table creation script is provided below. a) Call the procedure: UPDATE_SALES_HISTORY (The procedure name is important for our scripts to test and grade your code; please do not rename it (otherwise our scripts will not run and your score will be 0). b) The procedure takes 2 parameters: (4-digit-year, 2-digit-month). Both parameters will be numeric, e.g., (2019, 11) will denote 2019 (year) and November (month). The...
Can you please provide the formula for the worksheet also.
CASE PROBLEMS Level 1- Analyzing Sales for Crèmes Ice Cream Judd Hemming is the eastern regional marketing manager for Crèmes Ice Cream. Eac quarter, he completes two separate analyses: an analysis comparing ice cream flavor sale volumes from all regional locations with the same quarter sales volumes from the previou year and an analysis comparing total sales in dollars, including mean, median, mode, and standard deviation, of sales by store....