与えられる以下の表(それはセッションを持つユーザーアイテム閲覧履歴を記録)パーティションを持つクエリとカウント
create table view_log (
server_time timestamp,
device char(2),
session_id char(10),
uid char(7),
item_id char(7)
);
私は次のコードが何をするかを理解しようとしています。..
create table coo_cs as
select
item_id,
session_id,
count(distinct session_id)/(sum(count(distinct session_id)) over (partition by item_id)) cs
from view_log
group by item_id, session_id;
私はpartition
の行を分解しようとしましたが、それは何をしているのかを理解するためにDISTINCT is not implemented for window functions
を出します。
私が理解し、基本的なpartition
とgroup by
が、上記のSQLの意味を理解することはできません。..
- 編集テストのためではなく、大規模なデータがあります
...
http://pakdd2017.recobell.io/site_view_log_small.csv000.gz
入力の小さなサブセットを提供した方が簡単になるでしょうデータと対応する結果セット –
使用しているデータベースで質問にタグを付けます。 –