Question: Using this hypothetical SQL Code from my design.(Feel free to add NUll values where apropriate) Can someone help create a stored procedure for a seller
Using this hypothetical SQL Code from my design.(Feel free to add NUll values where apropriate) Can someone help create a stored procedure for a seller to a new product? This information is as follows:New Product Use Case This occurs when a seller plans to sell a product it has not sold before. 1. The seller searches Amazons product list to determine if another seller is already selling the product. 2. If a different seller is already selling the product, a new listing is not required; the seller reuses the same listing. 3. If the product is not yet sold on Amazon, a new listing is created with the products name, description, price, and other relevant items. Every product added is linked to a product category (all categories are predefined by Amazon), for example, Computers, Electronics, Appliances, and similar. c. A seller adds two new products. The first is a selfdriving video camera which automatically follows a subject that is being recorded. The second is a holographic keyboard that emits a threedimensional projection of a keyboard and recognizes virtual key presses from the typist. Invoke the stored procedure twice to add these products, keeping in mind that products have at a minimum a name, description, price, and category. Thank You!! CREATE TABLE Sellers( Seller_ID VARCHAR2(50) PRIMARY KEY, Seller_first_name VARCHAR2(50), Seller_last_name VARCHAR2(50), Seller_type_code VARCHAR2(50) ); CREATE TABLE Customer( Customer_ID VARCHAR2(50) PRIMARY KEY, Cus_First_name VARCHAR2(50), Cus_Last_name VARCHAR2(50), Phone_Number NUMBER(20), Email_Address VARCHAR2(50) ); CREATE TABLE Addresses( Address_ID VARCHAR2(50) PRIMARY KEY, number_building VARCHAR2(50), Street_name VARCHAR2(50), Apartment_number VARCHAR2(50), City VARCHAR2(50), zipcode VARCHAR2(50), Country_code VARCHAR2(50) ); CREATE TABLE Product_Warehouse( Product_ID VARCHAR2(50) PRIMARY KEY, Product_category_code VARCHAR2(50), total_product_quantity NUMBER(20), seller_id VARCHAR2(50) REFERENCES Sellers(Seller_Id), product_name VARCHAR2(50), product_description VARCHAR2(200), product_price NUMBER(10), Product_condition_code VARCHAR2(50) ); CREATE TABLE Customer_Orders( Order_id VARCHAR2(50) UNIQUE, customer_Id VARCHAR2(50) REFERENCES Customer(Customer_ID), Cus_Pay_method VARCHAR2(50), Order_price NUMBER(10), Order_status VARCHAR2(50), Ship_speed_code VARCHAR2(50), Order_placed VARCHAR2(50), PRIMARY KEY(Order_id,customer_id) ); CREATE TABLE Customer_Addresses( Customer_id VARCHAR2(50) REFERENCES Customer(Customer_ID), Address_id VARCHAR2(50) REFERENCES Addresses(Address_id), address_type_code VARCHAR2(50), PRIMARY KEY(Customer_id,Address_id) ); CREATE TABLE Customer_order_products( order_id VARCHAR2(50) REFERENCES Customer_Orders(Order_id), Product_id VARCHAR2(50) REFERENCES Product_Warehouse(Product_ID), Product_quantity VARCHAR2(50), PRIMARY KEY(order_id,Product_id) ); CREATE TABLE Customer_order_delivery( Order_Id VARCHAR2(50) REFERENCES Customer_Orders(Order_id), date_reported DATE, delivery_status_code VARCHAR2(50), PRIMARY KEY(Order_Id) ); CREATE TABLE BILL( Bill_ID VARCHAR2(50) PRIMARY KEY, Order_ID VARCHAR2(50) REFERENCES Customer_Orders(Order_id), Order_price NUMBER(10), date_order_paid DATE, Bill_details VARCHAR2(200) ); Value Insertion: INSERT INTO Sellers VALUES('Seller_ID','Seller_first_name','Seller_last_name','Seller_type_code'); INSERT INTO Customer VALUES('Customer_ID','Cus_First_name','Cus_Last_name',Phone_Number,'Email_Address'); INSERT INTO Addresses VALUES('Address_ID','number_building','Street_name','Apartment_number','City','zipcode','Country_code'); INSERT INTO Product_Warehouse VALUES('Product_ID','Product_category_code',total_product_quantity,'seller_id','product_name','product_description',product_price,'Product_condition_code'); INSERT INTO Customer_Orders VALUES('Order_id','customer_Id','Cus_Pay_method',Order_price,'Order_status','Ship_speed_code','Order_placed'); INSERT INTO Customer_Addresses VALUES('Customer_id','Address_id','address_type_code'); INSERT INTO Customer_order_products VALUES('order_id','Product_id','Product_quantity'); INSERT INTO Customer_order_delivery VALUES('Order_Id',TO_DATE('date_reported', 'format'),'delivery_status_code'); INSERT INTO BILL VALUES('Bill_ID','Order_ID','Order_price',TO_DATE('date_order_paid', 'format'),'Bill_details');
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
