现在假设你是某家电子商务公司的销售部经理,你想将所有从你网站上买东西的顾客建立一张Schema表,以便于统计和研究。那么,请你将你能够想到的东西都写到Schema中去
一头雾水,急求大佬解惑

解决方案 »

  1.   

    表格设计:Schema
    时间  姓名 性别 年龄 市 区 地址 产品名称 产品类型 数量 价格 金额 支付方式 。按年龄段统计人均消费能力 
    select 20岁以下,人均消费能力=case count(*)>0 then sum(金额)/count(*) else 0 end from Schema where 年龄<=20
    select 20岁到30岁,人均消费能力=case count(*)>0 then sum(金额)/count(*) else 0 end from Schema where 年龄>20 and 年龄<=30 
    select 30岁到40岁,人均消费能力=case count(*)>0 then sum(金额)/count(*) else 0 end from Schema where 年龄>30 and 年龄<=40 按支付方式统计
    select 支付方式,消费额=sum(金额) from Schema group by 支付方式