Data Interview Qs - A hotel chain's loyal customers

InterviewQs

A hotel chain's loyal customers

SQL Database Querying Subquery Union

Forward this email to a friend or colleague and challenge them to solve it.

You are an analyst for a major US hotel chain which has locations all over the US. Your marketing team is planning a promotion focused around loyal customers, and they are trying to forecast how much revenue the promotion will bring in. However, they need help from you to understand how much revenue comes from "loyal" customers to plug into their model.

A "loyal" customer is defined as

  1. having a membership with your company's point system,
  2. meeting either of the below conditions
    1. having >2 stays at any hotel location
    2. having stayed at 3 different locations

You have a table showing all transactions made in 2017. The schema of the table is below:

Table: customer_transactions

Column Name Data Type Description
customer_id id id of the customer
hotel_id integer unique id for hotel
transaction_id integer id of the given transaction
first_night string first night of the stay, column format is "YYYY-mm-dd"
number_of_nights integer # of nights the customer stayed in hotel
total_spend integer total spend for transaction, in USD
is_member boolean indicates if the customer is a member of our points system

Given this, can you write a SQL query that calculates percent of revenue loyal customers brought in 2017?


 

Congratulations! You’ve accumulated 165 questions since joining our email list. Create a premium account to access detailed solutions to each problem (including this one) + our new Case studies.


Was this email forwarded to you? You can join our list here to receive questions

How did you like today's question?

15411 Boischatel, Montreal, QC, H9H1Y7, Canada
Don't want to get these emails anymore? We'll forgive you if you unsubscribe

Older messages

Ranking, splitting into quantiles with Python

Wednesday, July 21, 2021

Data Analysis, Python, Pandas, Statistics, Data Manipulation, Quantiles, InterviewQs Ranking, splitting into quantiles with Python Data Analysis Python Pandas Statistics Data Manipulation Quantiles

TV and hypertension case study - Hours spent watching TV

Monday, July 19, 2021

Python, Statistics, T-test, External Dataset, InterviewQs TV and hypertension case study - Hours spent watching TV Python Statistics T-test External Dataset Forward this email to a friend or colleague

Find n-th missing element in unsorted array

Friday, July 16, 2021

Python, Data Structures, Arrays, InterviewQs Find n-th missing element in unsorted array Python Data Structures Arrays Forward this email to a friend or colleague and challenge them to solve it.

Employee survey results

Friday, July 16, 2021

SQL, Database Querying, InterviewQs Employee survey results SQL Database Querying Forward this email to a friend or colleague and challenge them to solve it. You're consulting for a company, and

Consumer complaints on financial products

Monday, July 12, 2021

Data Analysis, Python, Pandas, Data Manipulation, External Dataset, InterviewQs Consumer complaints on financial products Data Analysis Python Pandas Data Manipulation External Dataset Forward this

You Might Also Like

It’s the age of super-online rap beefs

Tuesday, May 7, 2024

Drake and K.Dot's beef is telling of how much the Internet has influenced music View this email online in your browser By Alex Wilhelm Tuesday, May 7, 2024 Welcome to TechCrunch AM! Another day,

Dissecting 'architecting for fast, sustainable flow'

Tuesday, May 7, 2024

Get the public workshop's group discount You are receiving this email because you subscribed to the microservices.io mailing list. Sulfur Valley, Beitou District, Taipei City, Taiwan Helping

Improved tree-shaking in Rollup; Node v22.1.0; Deno 1.43; npm feedback; npm script runner; refactori

Tuesday, May 7, 2024

We have 10 links for you - Stay up-to-date on JavaScript and tools Rollup: improved tree-shaking due to tracking of const parameter values github.com github.com/liuly0322 @lukastaegert@webtoo.ls @

What to expect at Google I/O 2024

Tuesday, May 7, 2024

The Morning After It's Tuesday, May 07, 2024. Google's big developer showcase, encompassing software, hardware and all its consumer AI projects, is fast approaching. Google I/O's opening

Critical UNPATCHED Tinyproxy Flaw Opens Over 50,000 Hosts to Remote Code Execution

Tuesday, May 7, 2024

THN Daily Updates Newsletter cover Webinar -- The Future of Threat Hunting Is Powered by Generative AI From Data to Defense: Step Into the Next Era of Cybersecurity with CensysGPT Download Now

Post from Syncfusion Blogs on 05/07/2024

Tuesday, May 7, 2024

New blogs from Syncfusion Empower Your Data Insights: Integrating JavaScript Gantt Chart into Power BI By Alan Sangeeth This blog explains the steps to integrate the Syncfusion JavaScript Gantt Chart

Edge 393: Understanding Planning Techniques in Autonomous Agents

Tuesday, May 7, 2024

A taxonomy of planning in autonomous agents, the ADaPT planning method and the XLANG framework. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Not Your Grandpa’s Hearing Device

Tuesday, May 7, 2024

Dr. Marco Vietor and Paul Crusius have been creating successful businesses since college. Now they lead hear.com, the fastest growing hearing aid company in the world. This is their story. Let's be

Everything Apple will announce today

Tuesday, May 7, 2024

My $100 Temu tech haul; How to test AI on coding; Best NAS devices -- ZDNET ZDNET Tech Today - US May 7, 2024 placeholder Everything Apple will announce at its iPad event on May 7: iPad Pro, Air,

Learn How To Backlink Like a Pro, newsletterest1!

Tuesday, May 7, 2024

4 Tips To Elevate Your Backlink Strategy From HackerNoon Editors ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌ ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌ ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌  ͏ ‌