I only can use Compare , Count ,Find ,Join , Save and sort to do this.
question: What would you do to determine how many existing customers purchased another plan / phone?
table looks like this
Date / Label / UserID / Demographic Bucket/ Zip Code/ Time_Stamp
these are the only commands we are allowed to use !! :(
Compare: Comparison of 2 data files. Column 1 indicates the data that matches
Count:
Find:
Join :
Save: Allows you to save the results from a command. Eg if you Find x on column 2, the results will be only that data that qualifies. Use –k1 to save only column 1 , –k2 to save only column 2, etc.
sort:
Compare, Find, Save and Sort are not SQL keywords.
What would you do to determine how many existing customers purchased another plan / phone?
SELECT COUNT(*)
FROM (SELECT t.userid
FROM TABLE t
WHERE t.userid IS NOT NULL
--AND what determines a phone/plan would go here?
GROUP BY t.userid
HAVING COUNT(t.userid) > 1) x
The userid not being null qualifies as a customer, because to be logged in they should have a userid. How to determine who bought a plan? I can't tell from the info, but having more than one instance of the userid and/or plan/phone indicator satisfies the criteria for the inner query. The outer query just counts the [distinct] userids returned.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.