Swap Salary
An HR service stores employees in Salary: id UUID, name VARCHAR(100), sex lc_swap_sex_t (an ENUM with two values 'm' and 'f'), salary NUMERIC(15,2).
With a single SQL query, swap the sex values: every 'm' should become 'f', and every 'f' should become 'm'.
Use UPDATE. No temporary tables, no SELECT.
Just INSERT/UPDATE/DELETE — no trailing SELECT needed.
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in