Question
Write PL/SQL query for: Customer(CustomerId, FirstName, LastName, Address, PhoneNo, Age) Supplier(SupplierId, FirstName, LastName, Address, PhoneNo) Product(ProductId, ProductName, Category, SupplierId, ProductDescription) Inventory(ProductId, TotalStock, LastUpdatedOn) Orders(OrderId, CustomerId,
Write PL/SQL query for:
Customer(CustomerId, FirstName, LastName, Address, PhoneNo, Age)
Supplier(SupplierId, FirstName, LastName, Address, PhoneNo)
Product(ProductId, ProductName, Category, SupplierId, ProductDescription)
Inventory(ProductId, TotalStock, LastUpdatedOn)
Orders(OrderId, CustomerId, OrderDate, Status)
OrderItems(OrderId, ProductId, Quantity, UnitPrice, Discount)
Pro_age_categ: Find the top category ordered by customers of different age groups. This represents the hit category for each age group and helps in targeted advertising. Top category can be calculated by comparing the number of product units (total quantity sold) of each category ordered. Consider bins of size 10 for different ages. For example, a customer of age 45 will fall in bin {>40, <= 50}. The number of bins depends on the age groups of the customers available. If the lowest age available is 32 and largest is 67, then there will be 4 bins as {>30, <=40}, {>40, <=50}, {>50, <=60} and {>60, <=70}. The bin size is fixed but the number of bins depends on the range of age available.
output example:
HIT CATEGORIES >30, <=40 >40, <=50 >50, <=60 >60, <=70
Electronics Clothing Home Appliances Clothing
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