Sobes.tech
Middle

Write an SQL query to select active promo codes sorted by discount value in descending order.

sobes.tech AI

Answer from AI

sql SELECT * FROM promo_codes WHERE is_active = TRUE ORDER BY discount_amount DESC;


This query assumes that the `promo_codes` table has a boolean field `is_active` indicating whether the promo code is active, and a field `discount_amount` containing the discount value. The query selects only active promo codes and sorts them by discount amount in descending order.
Write an SQL query to select active promo codes… - sobes.tech