FastPrepBotany Query
Problems/Botany Query

Botany Query

Patreon logoPatreon● EasyNEW GRADOA

Updated Apr 2023

QuestionConstraints

Problem statement

Source note: Reported in a Patreon new grad online assessment for a full-time software engineering role, posted on 2023-04-20. It was the third of three questions, a MySQL query. A plant table gives each plant's name, species and seed date. A weather table lists the weather types each species blooms in. The task is to list every plant whose species blooms in exactly one weather type, with that type. The screenshots show the whole task, with three sample plants, four sample weather rows and the two-row answer, which is Example 1.

The screenshots do not say what happens to a plant whose species has no weather row. Here, that plant is not returned. The table sizes (up to 1000 rows each) are ours. So are the rules that a species and weather type pair never repeats and that no value is missing. You can also answer in PostgreSQL or Pandas, and table and column names are in lower case. Example 2 and the hidden tests are ours.

Our version is about 95% the same as the reported question.

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

MySQLPostgreSQLPandas

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.

ColumnTypeNullableDescription
nameTextNoPlant name; no two plants share a name.
speciesTextNoThe plant's species; matches weather.plant_species.
seed_dateDateNoDate the plant was seeded.

weather

One row for each weather type in which plants of a species bloom.

ColumnTypeNullableDescription
plant_speciesTextNoA species.
typeTextNoA weather type in which that species blooms.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
nameTextNo—
typeTextNo—

Row order: any order is accepted. Numeric tolerance: 0.

Constraints

  • Each table has between 0 and 1000 rows.
  • No two plants share a name.
  • A pair of plant_species and type appears at most once in weather.
  • 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
All Patreon interview questionsSee Patreon hiring insights