Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQL ERROR near returning WITH total _ customers AS ( SELECT COUNT ( DISTINCT customerID ) AS total FROM JVS _ Schema.Customer ) ,

SQL ERROR near returning
WITH total_customers AS (
SELECT COUNT(DISTINCT customerID) AS total
FROM "JVS_Schema".Customer
),
returning_customers AS (
SELECT COUNT(DISTINCT C.customerID) AS Returning
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
)
SELECT (returning_customers.returning / C.total)*100 AS retention_rate
FROM returning_customers AS returning, total_customers AS total;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

Group Size and Communication

Answered: 1 week ago

Question

Understanding Group Roles

Answered: 1 week ago