Question: SQL Query error SELECT COUNT ( DISTINCT C . customerID ) AS Total _ customers FROM ( SELECT COUNT ( DISTINCT C . customerID )

SQL Query error
SELECT COUNT(DISTINCT C.customerID) AS Total_customers
FROM(
SELECT COUNT(DISTINCT C.customerID) AS returning_customers
FROM "JVS_Schema".Customer AS C
JOIN "JVS_Schema".Rental AS R ON R.CustomerID=C.CustomerID
JOIN "JVS_Schema".Order AS O ON R.OrderID=O.OrderID
GROUP BY C.customerID HAVING COUNT(O.OrderID)>1
)AS SUBQUERY
SELECT (returning_customers / total_customers)*100 AS retention_rate;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!