ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 1041|回复: 2

[求助] 求大神解答一道数据分析题

[复制链接]

TA的精华主题

TA的得分主题

发表于 2015-11-15 02:25 | 显示全部楼层 |阅读模式
求助大神解答一道Excel数据分析的题,问题解释和excel数据都在附件里! 跪谢跪谢
问题如下
1.     Usingthe Restaurant Data in the attached workbook please analyze the impact of theintroduction of the Presto device.
a.     Astrong answer will compare restaurant variables before and after theintroduction of the Presto device. Comparisons should also be made using thecontrol locations that never had the devices installed.  
Additionally,E la Carte makes money from selling games and is interested in being able toaccurately predict our revenue.  
1.     Usingthe same dataset, create a predictive model of Game Revenue based on variablesyou may think are appropriate. Please include statistical support for yourmodel.


求大神解答.zip

1.93 MB, 下载次数: 3

excel 和问题

TA的精华主题

TA的得分主题

发表于 2015-11-15 09:46 | 显示全部楼层
附件根本就无法解压!Presto是地名吧?

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-11-15 10:06 | 显示全部楼层
问题是 SQL Test
Please identify what the attached SQL query (query.txt) is gathering and aggregating. Generate a final table with the columns labeled with the original source. In addition, please identify places that could be improved for SQL performance.

query如下
select waiters.id as waiter_id,
            waiters.first_name as first_name,
            waiters.last_name as last_name,
            waiters.personal_id as personal_id,
            coalesce(payment_table.total_sum,0) as total_payments,
            coalesce(tip_table.tip,0) as total_tips,
            coalesce(tip_table.percentage,0) as tip_percent,
            coalesce(waiter_table.num_tables,0) as num_tables,
            coalesce(payment_table.payments,0) as num_payments,
            coalesce(items_table.num_items, 0) as num_items,
            coalesce(payment_table.rating, 0) as rating,
            coalesce(games_table.count, 0) as num_games,
            coalesce(tip_table.total_sum,0) as total_tip_payments,
            coalesce(emails_table.num_emails,0) as num_emails,
            coalesce(payment_table.turn_time,0) as turn_time,
            coalesce(features_table.revenue,0) as game_revenue
        from waiters
        inner join restaurants on restaurants.id = waiters.restaurant_id
        left outer join (
            select
                count(*) as num_tables
            from (
                select distinct on(date(last_updated), pos_check_number)
                    *
                from piston_check
                where last_updated between %s and %s
                and waiter_id = %s
                order by date(last_updated), pos_check_number, last_updated desc
            ) as moo
        ) as waiter_table on true
        left outer join(
            SELECT
                coalesce(sum(total),0) as total_sum,
                count(*) as payments,
                avg(turn_time) as turn_time,
                avg(star_rating) as rating
            FROM piston_payment
            INNER JOIN piston_check ON piston_payment.check_id = piston_check.id
            where piston_payment.last_updated between %s and %s
            AND piston_payment.tender_type != 'cash'
            and piston_check.waiter_id = %s
        ) as payment_table on true
        left outer join(
            select
                coalesce(SUM(tip),0) as tip,
                coalesce(sum(total),0) as total_sum,
                case when (sum(total) - sum(tip) = 0 or sum(tip) = 0) then 0 else sum(tip) / (sum(total) - sum(tip)) *100 end as percentage
            from (
                SELECT piston_check.waiter_id as waiter_id,
                    sum(tip) as tip,
                    sum(total) as total
                FROM piston_payment
                INNER JOIN piston_check ON piston_payment.check_id = piston_check.id
                where piston_payment.last_updated between %s and %s
                AND piston_payment.tender_type != 'cash'
                and piston_check.waiter_id = %s
                group by date(piston_check.last_updated at time zone 'UTC' - interval '11 hours'), piston_check.pos_check_number, waiter_id
            ) as moo
            where case when total-tip=0 or tip=0 then 0 else tip end > 0
        ) as tip_table on true
        left outer join (
            select count(*) as num_items
            from piston_order_item
            inner join piston_order on piston_order_item.order_id = piston_order.id
            inner join piston_check on piston_order.check_id = piston_check.id
            where piston_order.last_updated between %s and %s
            and piston_order_item.item_name != 'Presto Games'
            and piston_order_item.parent_order_item_id is null
            and piston_check.waiter_id = %s
        ) as items_table on true
        left outer join (
            select
                count (*) as count
            from piston_game
            inner join piston_check on piston_check.id = piston_game.check_id
            where piston_game.last_updated between %s and %s
            and piston_check.waiter_id = %s
        ) as games_table on true
        left outer join(
            select count(*) as num_emails
            from piston_email
            inner join piston_check on check_id = piston_check.id
            where piston_email.last_updated between %s and %s
            and piston_check.waiter_id = %s
            and email ~* '^[A-Za-z0-9._%%-]+@[A-Za-z0-9.-]+[.][A-Za-z]+$'
            and not email ~* 'elacarte.com$'
            and joined_club=true
        ) as emails_table on true
        left outer join (
            select sum(charge) as revenue
            from piston_game_feature
            inner join piston_game on game_id = piston_game.id
            inner join piston_check on piston_check.id = piston_game.check_id
            where piston_game.last_updated between %s and %s
            and piston_check.waiter_id = %s
        ) as features_table on true
        where restaurants.code = %s
        and waiters.id = %s

求解答啊
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-9-28 11:22 , Processed in 0.029501 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表