FastPrepExecute In-Memory SQL Queries
Problems/Execute In-Memory SQL Queries

Execute In-Memory SQL Queries

Retool logoRetool● MediumFULLTIMENEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Multiple firsthand Retool reports from 2024 through 2026 ask for an in-memory SQL engine over key and value records. Step by step, they add SELECT, WHERE, LIMIT, nested conditions, aggregation, GROUP BY, and HAVING. We chose the interface that takes a stored list of operations.

Execute a finite ordered batch against an in-memory database service. The five input arrays have equal length. Return one result per operation.

  • CREATE_DB creates a database.
  • CREATE_TABLE creates a table in an existing database.
  • INSERT stores values[i] at a new integer row ID.
  • READ returns the current value for an existing row.
  • UPDATE replaces the value of an existing row.
  • DELETE removes an existing row.

A successful write returns OK. A missing parent, missing row, or duplicate create/insert returns ERROR and changes no state. Fields unused by an operation may contain the empty value for their type.

Function

executeStorageOperations(operations: String[], databases: String[], tables: String[], ids: int[], values: String[]) → String[]

Examples

Example 1

operations = ["CREATE_DB","CREATE_TABLE","INSERT","READ","UPDATE","READ","DELETE","READ"]databases = ["sales","sales","sales","sales","sales","sales","sales","sales"]tables = ["","orders","orders","orders","orders","orders","orders","orders"]ids = [0,0,7,7,7,7,7,7]values = ["","","new","","paid","","",""]return = ["OK","OK","OK","new","OK","paid","OK","ERROR"]

The update changes the stored row and deletion removes it.

Example 2

operations = ["CREATE_TABLE","CREATE_DB","CREATE_DB","CREATE_TABLE","INSERT","INSERT"]databases = ["x","x","x","x","x","x"]tables = ["t","","","t","t","t"]ids = [0,0,0,0,1,1]values = ["","","","","a","b"]return = ["ERROR","OK","ERROR","OK","OK","ERROR"]

Parents must exist and duplicate creates or inserts fail.

Example 3

operations = []databases = []tables = []ids = []values = []return = []

An empty batch has no results.

Constraints

  • 0 <= operations.length <= 100000 and all five arrays have that length.
  • Every operation is one of the six documented uppercase strings.
  • Database and table names used by their operations are nonempty and at most 100 characters.
  • Row IDs are nonnegative, and stored values have at most 1000 characters.

More Retool interview questions

  • Maximum Profit with Exactly One Stock TransactionPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Order Sources by Their DependenciesPHONE SCREEN · Seen Oct 2026
  • Maximum Profit with Exactly Two Stock TransactionsPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Next Consistent Wordle GuessPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2024
  • Wordle FeedbackPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2024
  • Wordle Guess LoopPHONE SCREEN · Seen Jun 2024
  • Markov Transition Counts and ProbabilitiesONSITE INTERVIEW · Seen Mar 2026

Similar questions at other companies

  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • LRU CacheServiceNow · PHONE SCREEN · ONSITE INTERVIEWServiceNow interview questions
  • Mutable Points in a Hash Set and a ListMillennium · PHONE SCREENMillennium interview questions
  • Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions
  • Rectangle Point Coverage CountsOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • In-Memory Vault File SystemHarvey · ONSITE INTERVIEWHarvey interview questions
  • File Storage ServiceCresta · PHONE SCREENCresta interview questions
  • Hash Map with Separate ChainingApplied Intuition · ONSITE INTERVIEWApplied Intuition interview questions
  • Camel CardsRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
All Retool interview questionsSee Retool hiring insights
Saved
class Solution {
    public String[] executeStorageOperations(String[] operations, String[] databases, String[] tables, int[] ids, String[] values) {
        // Write your solution here.
    }
}
Checking account…