转载自:https://cyberomin.github.io/startup/2018/07/01/sql-ml-ai.html
No, you don't need ML/AI. You need SQL
A while ago, I did a Twitter thread about the need to use traditional and existing tools to solve everyday business problems other than jumping on new buzzwords, sexy and often times complicated technologies.
The thread did pretty well, eventually making it to the number one spot on Hackernews. The aftermath of its mini popularity was that it sparked some interesting conversation. With a camp agreeing with what I said and another not agreeing entirely with what I said to those who called me stupid and delusional. Well, the internet can be a wild wild west.
My attempt with this article isn’t to convince you to use my approach, rather, I intend to unpack what exactly I was saying in my initial Twitter thread.
You see, as the years go by, some interesting technologies and concept spring forth — machine learning, the blockchain, artificial intelligence, virtual reality, augmented reality, etc — while some existing ones take the back seat. It’s not uncommon to hear these days about people building fantastic products today backed by blockchain. I have seen blockchain backed e-commerce services, social networks and properties. The list goes on. I hear these days for you to close that funding round quickly and early enough, you must throw in “Blockchain” even if it has no relevance in the grand scheme of things.
A while ago, it was Machine learning and Artificial Intelligence. Everybody and their mother that had a landing page with a “join the waitlist” field had ML/AI on that page. Heaven forbids you put up that initial page and there was no mention of AI. Seriously, are you really in business? But honestly, this doesn’t have to be the case. One technology I am still bullish about to this day is the SQL (Structured Query Language). This over 40 years old technology is as relevant today as it was when it first appeared in 1974. While it has gone through some refining over the years, it’s still as powerful as ever.
I have spent all of my career in technology and I spent a good part of it working in e-commerce and I saw first hand how this technology allowed us to grow and scale the business. We used this technology to our advantage, as it allowed us to explore some interesting information from the data we gathered. These data included but not limited to consumer behaviours, shopping pattern and habits. It even allowed us to predict what stock keeping unit(SKU) we should be holding and what we shouldn’t. It even allowed us to delight our customers and re-engage with those that fell along the way. Let me tell you how we did it and how you too can.
It’s always fun when I speak to founders and potential founders and they are quick to tell me how they want to use AI/ML to improve customer retention and improve lifetime value(LTV). The truth is, they don’t even need machine learning or any of those fancy stuff. A properly written SQL is what they need. In a former life, I used to write SQL queries to extract valuable information and insights from the data we generated. One time, we needed to know who the customer of the week was, the idea was to 1) recognize them and 2) reward them. This simple and unexpected gesture the company displayed toward its customers always left people super delighted and it turned them into an evangelist. It wasn’t uncommon to see messages on social media like “Wow, Konga just rewarded me with N2,000 voucher for being the customer of the week. I didn’t expect this. Thanks, guys, you are the best.”
Do this proved more effective than spending that money on advertisement, don’t get me wrong, traditional advertising still has its place, but nothing beats word of mouth from a trusted friend. Surprisingly, getting this information wasn’t that difficult. No fancy technology was needed other than the good old SQL. To get the customer of the week, we basically wrote an SQL that selects from orders table where basket size is the biggest for that week. When we get this information, we will email a nice thank you note to the customer and attach a small coupon/voucher. Guess what? 99% of these people became repeat customers. We never needed ML. We just wrote a simple SQL and got this information.
One time we needed to reconnect with customers that hadn’t shopped in a while. Since I was responsible for this, I wrote a SQL query that gathered all the customers whose last shopped date was 3 months or more. The query, yet again, was surprisingly simple. I will write a query like select from order table where last shop date is 3 or more months. When we get this information, we will send a nice “we miss you, come back and here’s X Naira voucher” email. The conversation rate for this one was always greater than 50%. And there was always a flurry of messages on social media too. In my opinion, these two strategies were and still is a lot more effective than spending on Google and Facebook ads.
We applied this same thinking to newsletters. I mean, why send a generic newsletter to everyone when you could attempt to personalize it? Solution? I wrote SQL queries to check basket content and extract individual items. From these items, we could build a newsletter off it and target relevant content. For instance, say a person bought a pair of shoe, sunglasses and a book. For their newsletter, we will show include shoes, sunglasses and books. This was a lot more relevant than sending random stuff. I mean, why send a letter with breast pumps to a man that just bought a pair of sneakers? It doesn’t even make sense. The typical open rate for most marketing emails is anywhere between 7 - 10%. But when we did our work well, we saw close to 25 - 30%.
This is three times more than the industry standard. Another nice touch for those emails was that we addressed people by their names. No Dear Customer. It was always Dear Celestine, Dear Omin, etc. It brought a human touch to the whole game. It showed we cared. All of these happened courtesy of the good old SQL, not some fancy machine learning.
For those customers who couldn’t complete their orders for one reason or another, we didn’t let them drop off too. For as long as they added an item to their cart, that suggests that they had intentions of buying. To get them to check out, I wrote a nice SQL script, paired it with a CRON job and this combination fired an email to customers whose carts had a last updated period of 48 hours or more. Guess what? It worked. Because we could track these emails, we could tell people came back to complete their orders based on those emails. Yet again, the SQL for this was super simple. It selected from the cart where the state is not empty and last update period was more than or equal to 48hrs. We set the CRON to run at 2 AM every day, this was period with less activity and traffic. Customers will then wake up to emails reminding them about their abandoned carts. Talk about reengagement. Nothing fancy here, just SQL, Bash and CRON in action.
Since payment on delivery(POD) was big and still is a thing, SQL yet again came in handy. Customers that will cancel orders three consecutive times, we placed them under a high alert bucket. Next time they made an order, we called and made sure they actually needed the order. This way, we saved time and unnecessary stress. Altogether, POD can be disabled for these customers and the only payment method will be a card or a wallet. In e-commerce, logistics is expensive, so it made sense to focus on serious customers. We didn’t need ML or some fancy AI for this problem. Again, well-written SQL was all we needed.
For orders that weren’t delivered during our SLA window, we used SQL queries to manage customer expectations too. We selected from orders where status is not delivered and order date >= 7 days. As this is the standard delivery period. We paired this with a CRON job that fires email and SMS to customers. While customers didn’t immediately jump and clapped for us. At the very least, it reassured them that we actually cared and were working to solve the problem. Nothing is as annoying as delayed orders.
This particular solution also had a dramatic effect on our NPS. Again, good old SQL + Bash saving the day.
Bonus: Sift Science is doing an amazing job with fraud prevention. But SQL can come in handy too. If a person tries to checkout with 3 different cards at the same time and these cards bounced, something funny is happening. The first and obvious thing to do here is to block their account temporary for a while. You will be saving the potential card owners a lot of headaches. You don’t need to store card details, just store card checkout attempt for a particular order number and you will be fine. These are low hanging fruits that need no ML but a well-written SQL.
I am knocking on ML/AI. These technologies have their place, if anything, Amazon has proven their effectiveness. But if you’re running a small online store with between 1,000 - 10,000 customers, then you can still very much live on SQL. Besides, the ML/AI talents aren’t a dime a dozen.
You run an e-commerce store and you need help on any of these? Reach out, I am always happy to listen to your problem.
I'll love to hear from you