BackendQuestion 40 of 52
Phantom Reads
Problem
Transaction A runs a count query on orders. Meanwhile, Transaction B inserts a new order and commits. Transaction A runs the count query again and sees a different count. This is a Phantom Read. Write a query that outputs isolation_level with the value: "Phantom reads are prevented by setting the isolation level to Repeatable Read (which locks read ranges) or Serializable."
Database Schema
This problem acts as a scratchpad. You will write your own DDL/DML or conceptual queries, so there is no predefined schema.
Try It
Loading playground environment...