The tables are:
1) Producers: id, name
2) Products: id, name, price, category_id, producer_id
3) Customers: id, name, surname, age, country_id
4) Customer_orders: id, customer_id, product_id, quantity, discount, order_date
I need to find the prodcuer, who's income was the highest, in other words: find a producer for which the sum of all prodcut price * quantity - discount is the highest.
I suppose, that I should join table customer_orders with product_id column on products, and products with producers table on column id and then calculate the appropriate income for all producers and then find the maximum value.
The problem is, how to write in in MySql.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)