0

I would like to get all the new and returned users from a user_traffic table. Just wondering what would be the approach in solving this problem. Any thoughts/inputs would be appreciated. I am not expecting a ready made solution for this problem but any kind of directional inputs would help me. Thank you.

user_traffic : Session_ID, session_day, glance_view_id, user_id, product_id.

Sample Input :-

create table user_traffic (session_id number(6), session_day date, 
                           user_id number(6), product_id number(6));

insert into user_traffic values (  1, date '2016-09-07', 101, 1);
insert into user_traffic values (  2, date '2016-09-07', 101, 4);
insert into user_traffic values (  3, date '2016-09-07', 102, 1);
insert into user_traffic values (  4, date '2016-09-08', 101, 2);
insert into user_traffic values (  5, date '2016-09-08', 101, 4);
insert into user_traffic values (  6, date '2016-09-09', 102, 1);
insert into user_traffic values (  7, date '2016-09-10', 102, 1);
insert into user_traffic values (  8, date '2016-09-10', 103, 3);
Teja
  • 13,214
  • 36
  • 93
  • 155
  • ?? Schema means table names, what you show are just column names. Please start there: what tables you have, what columns each of them has, unique and NON NULLABLE constraints, data types, referential constraints. Then: What is a "user" and what is "new" vs "returning" etc. Show a small sample of input data, what the output should look like (in plain English) and the logic to get from input to output. –  Oct 01 '16 at 00:56
  • @Teja . . . I'm voting to close this (to put the question out of its misery). Ask another question and show (preferably in tabular form as well as inserts) what the data looks like and what you want to get out of it. Your question mentions things like MTD and YTD, which imply summaries, but the first sentence says you want to get "users". So, the question is unclear. – Gordon Linoff Oct 02 '16 at 02:51

0 Answers0