Data Interview Qs - Grouping similarly weighted animals

InterviewQs

Grouping similarly weighted animals

SQL Database Querying Self-join

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

Hi, 

You're given the following table showing the weights (in pounds) of various animals:

Table: animal_weights

animal weight
Blue whale 136000
Humpback whale 30000
Gray whale 28500
Aardvark 60
Leopard 54
Cheetah 54
... ...

Write a SQL query that evaluates each animal in our list and returns all animals within the same list that are within 10% of the evaluating animal's weight. For example, if we're evaluating the humpback whale, we would want to aggregate a list of animals that are between 27,000 and 33,000 pounds. Given the partial table above, our query should return:

animal similar_weight
Blue whale null
Humpback whale Grey whale
Gray whale Humpback whale
Aardvark Leopard, Cheetah
Leopard Cheetah
Cheetah Leopard

You can view/query the table in an interactive SQL fiddle here.


 

You’ve accumulated 393 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

Key phrases

Older messages

Recruiting spend as a proportion of total expenses

Monday, January 2, 2023

Data Analysis, Python, Pandas, Data Manipulation, Data Visualization, External Dataset, InterviewQs Recruiting spend as a proportion of total expenses Data Analysis Python Pandas Data Manipulation Data

Minimum path sum in matrix

Friday, December 30, 2022

Python, Algorithms, Data Structures, Dynamic Programming, InterviewQs Minimum path sum in matrix Python Algorithms Data Structures Dynamic Programming Forward this email to a friend or colleague and

Steps to creating a machine learning model

Wednesday, December 28, 2022

Statistics, Case study, Machine Learning, InterviewQs Steps to creating a machine learning model Statistics Case study Machine Learning Forward this email to a friend or colleague and challenge them to

Histogram of daily sales in SQL

Monday, December 26, 2022

SQL, Database Querying, Subquery, Histogram, InterviewQs Histogram of daily sales in SQL SQL Database Querying Subquery Histogram Forward this email to a friend or colleague and challenge them to solve

Average head coach salary by division

Friday, December 23, 2022

Data Analysis, Python, Pandas, Data Manipulation, Data Visualization, External Dataset, InterviewQs Average head coach salary by division Data Analysis Python Pandas Data Manipulation Data

You Might Also Like

📧 Request Response Messaging Pattern With MassTransit

Saturday, April 27, 2024

​ Request Response Messaging Pattern With MassTransit Read on: m​y website / Read time: 5 minutes BROUGHT TO YOU BY ​ Get ready for POST/CON 24! ​ Join us in San Francisco from April 30 - May 1 for

Tesla Autopilot investigation closed

Friday, April 26, 2024

Inside the IBM-HashiCorp deal and Thoma Bravo takes another company private View this email online in your browser By Christine Hall Friday, April 26, 2024 Good afternoon, and welcome to TechCrunch PM.

Microsoft's and Google's bet on AI is paying off - Weekly News Roundup - Issue #464

Friday, April 26, 2024

Plus: AI-controlled F-16 has been dogfighting with humans; Grok-1.5 Vision; BionicBee; Microsoft's AI generates realistic deepfakes from a single photo; and more! ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

🤓 The Meta Quest Might Be the VR Steam Deck Soon — Games to Play After Finishing Wordle

Friday, April 26, 2024

Also: Why a Cheap Soundbar Is Better Than Nothing, and More! How-To Geek Logo April 26, 2024 Did You Know TMI: Rhinotillexomania is the medical term for obsessive nose picking. 🖥️ Get Those Updates

JSK Daily for Apr 26, 2024

Friday, April 26, 2024

JSK Daily for Apr 26, 2024 View this email in your browser A community curated daily e-mail of JavaScript news A Solid primer on Signals with Ryan Carniato (JS Party #320) Ryan Carniato joins Amal

So are we banning TikTok or what?

Friday, April 26, 2024

Also: Can an influencer really tank an $800M company? View this email online in your browser By Haje Jan Kamps Friday, April 26, 2024 Image Credits: Jonathan Raa/NurPhoto / Getty Images Welcome to

[AI Incubator] 300+ people are already in. Enrollment closes tonight at 11:59pm PT.

Friday, April 26, 2024

How to decide if you're ready. ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Daily Coding Problem: Problem #1423 [Medium]

Friday, April 26, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Google. You are given an array of nonnegative integers. Let's say you start at the

Data science for Product Managers

Friday, April 26, 2024

Crucial resources to empower you with data that matters. ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Inner Thoughts

Friday, April 26, 2024

'The Inner Circle' Comes Around... Inner Thoughts By MG Siegler • 26 Apr 2024 View in browser View in browser If you'll allow me a brief meta blurb this week (not a Meta blurb, plenty of