Skip to content

Identifying products that a customer owns

I want to check whether my customer owns an iPhone, iPad, or Macbook. I am not looking for how many iPhone or iPad or Macbook one customer has, I just want to identify if they own any of them, or if they own any two, or if they own all three. I am thinking of using the CASE WHEN function

How can I calculate percentages from total rows and status in sql?

I have a table that contains a list of templates and statuses that I am trying to calculate percentages on. My schema looks like the following: SQL SQL to Create DB Sample Data: What I’m trying to achieve: The query I have so far is the following: The problem I have is that my percentages return nothing…

How to use case statement and min() with group by?

The following query when I that execute It seems error ORA-00934: group function is not allowed here I guess , there is error min() in group by. How can I solve this problem? Answer You have to use analytical MIN() function like the below without group by