FastPrepExecute In-Memory SQL Storage Operations
Problems/Execute In-Memory SQL Storage Operations

Execute In-Memory SQL Storage Operations

Fivetran logoFivetran● MediumFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report names database and table creation plus row insert, read, update, and delete operations backed by disk. It omits wire responses and persistence infrastructure; this practice version uses a finite in-memory operation sequence with deterministic success and error results. The judged core task matches the visible report at about 85%.

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 Fivetran problems

  • Reschedule Meetings for Maximum Free TimeOA · Seen Nov 2026
  • Aladdin and the Magic CarpetPHONE SCREEN · Seen Jun 2025
  • Connected GroupsONSITE INTERVIEW · Seen Jun 2024
All Fivetran interview questionsSee Fivetran hiring insights
Saved
class Solution {
    public String[] executeStorageOperations(String[] operations, String[] databases, String[] tables, int[] ids, String[] values) {
        // Write your solution here.
    }
}
Checking account…