Botany Query
Updated
Problem statement
Write a query that returns every plant whose species blooms in exactly one weather type, together with that weather type. A plant blooms in the weather types listed in weather for its species: plant.species matches weather.plant_species.
Each row of the result should contain plant.name and weather.type, so the result columns are name and type. The order of the rows does not matter.
Practice rule added by FastPrep: a plant whose species has no row in weather blooms in no weather type, so it is not returned.
Table schema
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
plant
One row per plant. name is the table's primary key, so no two plants share a name.
| Column | Type | Nullable | Description |
|---|---|---|---|
| name | Text | No | Plant name; no two plants share a name. |
| species | Text | No | The plant's species; matches weather.plant_species. |
| seed_date | Date | No | Date the plant was seeded. |
weather
One row for each weather type in which plants of a species bloom.
| Column | Type | Nullable | Description |
|---|---|---|---|
| plant_species | Text | No | A species. |
| type | Text | No | A weather type in which that species blooms. |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| name | Text | No | — |
| type | Text | No | — |
Row order: any order is accepted. Numeric tolerance: 0.
Constraints
- Each table has between
0and1000rows. - No two plants share a
name. - A pair of
plant_speciesandtypeappears at most once inweather. - No column is ever
NULL.
More Patreon interview questions
- Three SumOA · Seen Apr 2025
- Make Layer Times OddOA · Seen Oct 2024
- Sum of Subarray RegionsOA · Seen Oct 2024
- Binary Cardinality SortingOA · Seen Apr 2023
- Closest NumbersOA · Seen Apr 2023
- Maximum Books From BundlesOA · Seen Apr 2023
- Professors Teaching Outside Their DepartmentOA · Seen Apr 2023
- Math with Lego BlocksOA · Seen Apr 2023
- Sliding-Window API Rate LimiterPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Employee Importance from a DictionaryPHONE SCREEN · Seen Feb 2026
Similar questions at other companies
- Build Taxi Driver Performance FeaturesBoston Consulting Group · OABoston Consulting Group interview questions
- Students Scoring Above AverageCapstone Investment Advisors · OA
- Bond Interest Summary Above 3%Wells Fargo · OAWells Fargo interview questions
- Employee Promotion OpportunitiesIntuit · OAIntuit interview questions
- Students and Their SubjectsBirla Pivot · OA
- Companies with Average Salary Above 40000AT&T · OAAT&T interview questions
- Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
- Companies Above a Salary ThresholdVerisk · OA
- Customer Resource Usage AnalysisIBM · OAIBM interview questions
- Customers Who Never OrderedAccenture · OAAccenture interview questions