Question: Answer the questions using the database below. Tables and data contained in the database of a company that sells stationery products are given below. 1.
Answer the questions using the database below. Tables and data contained in the database of a company that sells stationery products are given below.
1. Write the query listing the number and name of the customer who ordered the maximum quantity of the product named "Pen".
2. Create a view named "Unsold_Products" that lists the numbers, names, stock numbers and total price of the products that have not been ordered yet.
3. When a new order is added, write the trigger that updates the stock quantity information of that product in the products table.
- When answering the questions, assume that each order will contain one type of product.
- PK: Primary Key
- FK: Foreign Key
- The queries should be prepared in MAMP program to run in MySQL.
- Trigger will be created by typing SQL command, not interface
Products Orders Customers Product No (PK) Order_number (PK) Customer_number (PK) Product Name Product No (FK) Customer name Price Customer number (FK) Address Stock_ Quantity Piece History Products Table: Product No (FK) 1 N Product Name pencil notebook eraser ruler Price 100 50 10 75 Stock_ Quantity 10 30 40 23 3 4 Orders Table: History Order_number Product_No (PK) (FK) 10 2 11 1 12 2 13 1 Customer_number Piece (FK) 111 2 111 1 111 34 112 5 2020-12-05 2020-12-06 2020-12-07 2020-12-07 Customers Table: Customer_number (PK) 111 112 113 Customer_name Ayse yilmaz Veli can Address ankaya Ankara Karyaka Tokat Dikmen Ankara Ali ay
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
