SQL: the probability of a customer to keep on buying on next months [closed]
up vote
1
down vote
favorite
I have this table of purchases, a customer and a month he bought a product. A short example:
*customer_ID* | *month_year*
1 | 2018-01
2 | 2018-02
1 | 2018-02
I need to query the probability of a customer to stay active (keep on buying) after 1 month, after 2 months and so on. Notice that the first month of purchasing might change between customers.
for example:
*month from first time* | *prob to keep buying*
0 month | 100%
1 month | 54%
2 month | 32%
3 month | 18%
etc... |
I would really appreciate any help.
Thanks in advance.
sql probability
closed as unclear what you're asking by D-Shih, Sami, Joakim Danielson, Temani Afif, Pearly Spencer Nov 10 at 22:51
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
|
show 1 more comment
up vote
1
down vote
favorite
I have this table of purchases, a customer and a month he bought a product. A short example:
*customer_ID* | *month_year*
1 | 2018-01
2 | 2018-02
1 | 2018-02
I need to query the probability of a customer to stay active (keep on buying) after 1 month, after 2 months and so on. Notice that the first month of purchasing might change between customers.
for example:
*month from first time* | *prob to keep buying*
0 month | 100%
1 month | 54%
2 month | 32%
3 month | 18%
etc... |
I would really appreciate any help.
Thanks in advance.
sql probability
closed as unclear what you're asking by D-Shih, Sami, Joakim Danielson, Temani Afif, Pearly Spencer Nov 10 at 22:51
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
Are you using SQL Server or MySQL?
– Sami
Nov 10 at 21:33
1
And what is your algorithm for that probability? What is the difference in probability for 2018-03 between customer 1 and 2 for instance?
– Joakim Danielson
Nov 10 at 22:14
MySQL/SQL Server it doesn't matter.
– net_y
Nov 10 at 22:31
This is the way I have been asked about this question. No more details. As I umderstand, the probability means for example: What is the probability that a customers (a general one) will make another purchase 1 month after his first purchase based on the first table. I need to integrate the whole data of the first table to come up with a general probability @JoakimDanielson Maybe I got the question wrong, but after a long thinking I figure out this was probably the intention.
– net_y
Nov 10 at 22:36
@Sami MySQL/SQL Server it doesn't matter
– net_y
Nov 10 at 22:39
|
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have this table of purchases, a customer and a month he bought a product. A short example:
*customer_ID* | *month_year*
1 | 2018-01
2 | 2018-02
1 | 2018-02
I need to query the probability of a customer to stay active (keep on buying) after 1 month, after 2 months and so on. Notice that the first month of purchasing might change between customers.
for example:
*month from first time* | *prob to keep buying*
0 month | 100%
1 month | 54%
2 month | 32%
3 month | 18%
etc... |
I would really appreciate any help.
Thanks in advance.
sql probability
I have this table of purchases, a customer and a month he bought a product. A short example:
*customer_ID* | *month_year*
1 | 2018-01
2 | 2018-02
1 | 2018-02
I need to query the probability of a customer to stay active (keep on buying) after 1 month, after 2 months and so on. Notice that the first month of purchasing might change between customers.
for example:
*month from first time* | *prob to keep buying*
0 month | 100%
1 month | 54%
2 month | 32%
3 month | 18%
etc... |
I would really appreciate any help.
Thanks in advance.
sql probability
sql probability
edited Nov 10 at 21:33
Sami
6,04531038
6,04531038
asked Nov 10 at 21:33
net_y
235
235
closed as unclear what you're asking by D-Shih, Sami, Joakim Danielson, Temani Afif, Pearly Spencer Nov 10 at 22:51
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by D-Shih, Sami, Joakim Danielson, Temani Afif, Pearly Spencer Nov 10 at 22:51
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
Are you using SQL Server or MySQL?
– Sami
Nov 10 at 21:33
1
And what is your algorithm for that probability? What is the difference in probability for 2018-03 between customer 1 and 2 for instance?
– Joakim Danielson
Nov 10 at 22:14
MySQL/SQL Server it doesn't matter.
– net_y
Nov 10 at 22:31
This is the way I have been asked about this question. No more details. As I umderstand, the probability means for example: What is the probability that a customers (a general one) will make another purchase 1 month after his first purchase based on the first table. I need to integrate the whole data of the first table to come up with a general probability @JoakimDanielson Maybe I got the question wrong, but after a long thinking I figure out this was probably the intention.
– net_y
Nov 10 at 22:36
@Sami MySQL/SQL Server it doesn't matter
– net_y
Nov 10 at 22:39
|
show 1 more comment
1
Are you using SQL Server or MySQL?
– Sami
Nov 10 at 21:33
1
And what is your algorithm for that probability? What is the difference in probability for 2018-03 between customer 1 and 2 for instance?
– Joakim Danielson
Nov 10 at 22:14
MySQL/SQL Server it doesn't matter.
– net_y
Nov 10 at 22:31
This is the way I have been asked about this question. No more details. As I umderstand, the probability means for example: What is the probability that a customers (a general one) will make another purchase 1 month after his first purchase based on the first table. I need to integrate the whole data of the first table to come up with a general probability @JoakimDanielson Maybe I got the question wrong, but after a long thinking I figure out this was probably the intention.
– net_y
Nov 10 at 22:36
@Sami MySQL/SQL Server it doesn't matter
– net_y
Nov 10 at 22:39
1
1
Are you using SQL Server or MySQL?
– Sami
Nov 10 at 21:33
Are you using SQL Server or MySQL?
– Sami
Nov 10 at 21:33
1
1
And what is your algorithm for that probability? What is the difference in probability for 2018-03 between customer 1 and 2 for instance?
– Joakim Danielson
Nov 10 at 22:14
And what is your algorithm for that probability? What is the difference in probability for 2018-03 between customer 1 and 2 for instance?
– Joakim Danielson
Nov 10 at 22:14
MySQL/SQL Server it doesn't matter.
– net_y
Nov 10 at 22:31
MySQL/SQL Server it doesn't matter.
– net_y
Nov 10 at 22:31
This is the way I have been asked about this question. No more details. As I umderstand, the probability means for example: What is the probability that a customers (a general one) will make another purchase 1 month after his first purchase based on the first table. I need to integrate the whole data of the first table to come up with a general probability @JoakimDanielson Maybe I got the question wrong, but after a long thinking I figure out this was probably the intention.
– net_y
Nov 10 at 22:36
This is the way I have been asked about this question. No more details. As I umderstand, the probability means for example: What is the probability that a customers (a general one) will make another purchase 1 month after his first purchase based on the first table. I need to integrate the whole data of the first table to come up with a general probability @JoakimDanielson Maybe I got the question wrong, but after a long thinking I figure out this was probably the intention.
– net_y
Nov 10 at 22:36
@Sami MySQL/SQL Server it doesn't matter
– net_y
Nov 10 at 22:39
@Sami MySQL/SQL Server it doesn't matter
– net_y
Nov 10 at 22:39
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
Are you using SQL Server or MySQL?
– Sami
Nov 10 at 21:33
1
And what is your algorithm for that probability? What is the difference in probability for 2018-03 between customer 1 and 2 for instance?
– Joakim Danielson
Nov 10 at 22:14
MySQL/SQL Server it doesn't matter.
– net_y
Nov 10 at 22:31
This is the way I have been asked about this question. No more details. As I umderstand, the probability means for example: What is the probability that a customers (a general one) will make another purchase 1 month after his first purchase based on the first table. I need to integrate the whole data of the first table to come up with a general probability @JoakimDanielson Maybe I got the question wrong, but after a long thinking I figure out this was probably the intention.
– net_y
Nov 10 at 22:36
@Sami MySQL/SQL Server it doesn't matter
– net_y
Nov 10 at 22:39