1596 每位顾客最经常订购的商品
SQL架构
Create table If Not Exists Customers_1569 (customer_id int, name varchar(10));
Create table If Not Exists Orders_1569 (order_id int, order_date date, customer_id int, product_id int);
Create table If Not Exists Products_1569 (product_id int, product_name varchar(20), price int);
Truncate table Customers_1569;
insert into Customers_1569 (customer_id, name) values ('1', 'Alice');
insert into Customers_1569 (customer_id, name) values ('2', 'Bob');
insert into Customers_1569 (customer_id, name) values ('3', 'Tom');
insert into Customers_1569 (customer_id, name) values ('4', 'Jerry');
insert into Customers_1569 (customer_id, name) values ('5', 'John');
Truncate table Orders_1569;
insert into Orders_1569 (order_id, order_date, customer_id, product_id) values ('1', '2020-07-31', '1', '1');
insert into Orders_1569 (order_id, order_date, customer_id, product_id) values ('2', '2020-7-30', '2', '2');
insert into Orders_1569 (order_id, order_date, customer_id, product_id) values ('3', '2020-08-29', '3', '3');
insert into Orders_1569 (order_id, order_date, customer_id, product_id) values ('4', '2020-07-29', '4', '1');
insert into Orde