Filter Odd-ID Movies and Preserve Rating Order

Quick Overview

Report Cinema rows with an odd id and description different from boring. Sort by rating descending. The source supplies no rule for ordering movies tied on rating; do not add a new required tie-break.

Filter Odd-ID Movies and Preserve Rating Order

Company: Meta

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

### Problem Report Cinema rows with an odd id and description different from boring. Sort by rating descending. The source supplies no rule for ordering movies tied on rating; do not add a new required tie-break. ### Tables Table: `Cinema` ```text +----------------+----------+ | Column Name | Type | +----------------+----------+ | id | int | | movie | varchar | | description | varchar | | rating | float | +----------------+----------+ id is the primary key (column with unique values) for this table. Each row contains information about the name of a movie, its genre, and its rating. rating is a 2 decimal places float in the range [0, 10] ``` ### Example ```text Cinema (id,movie,description,rating): (1,North,drama,8.50), (2,South,drama,9.00), (3,West,boring,9.50), (5,East,comedy,9.20) Output (id,movie,description,rating): (5,East,comedy,9.20), (1,North,drama,8.50) ``` ### What a Strong Answer Covers - Keep only rows meeting both the ID and description rules. - Return the complete qualifying rows in descending rating order, allowing ties. ### Follow-up Questions - How would you make the order deterministic when ratings tie? - How would you return only the highest-rated qualifying movie in each genre?

Overview: Report Cinema rows with an odd id and description different from boring. Sort by rating descending. The source supplies no rule for ordering movies tied on rating; do not add a new required tie-break.

Meta logo
Meta
Jul 5, 2026
easySoftware EngineerOtherData Manipulation (SQL/Python)
0
0

Problem

Report Cinema rows with an odd id and description different from boring. Sort by rating descending. The source supplies no rule for ordering movies tied on rating; do not add a new required tie-break.

Tables

Table: Cinema

+----------------+----------+
| Column Name    | Type     |
+----------------+----------+
| id             | int      |
| movie          | varchar  |
| description    | varchar  |
| rating         | float    |
+----------------+----------+
id is the primary key (column with unique values) for this table.
Each row contains information about the name of a movie, its genre, and its rating.
rating is a 2 decimal places float in the range [0, 10]

Example

Cinema (id,movie,description,rating): (1,North,drama,8.50), (2,South,drama,9.00), (3,West,boring,9.50), (5,East,comedy,9.20)
Output (id,movie,description,rating): (5,East,comedy,9.20), (1,North,drama,8.50)

What a Strong Answer Covers Guidance

  • Keep only rows meeting both the ID and description rules.
  • Return the complete qualifying rows in descending rating order, allowing ties.

Follow-up Questions Guidance

  • How would you make the order deterministic when ratings tie?
  • How would you return only the highest-rated qualifying movie in each genre?