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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!