Plans
Platforms
Requirements
Description
AirOps is an online service that generates SQL fix and query explain. It is available through website, extension, and API with free and paid plans. Account registration and email are required to use it.
SELECT category,
AVG (price)
FROM product p INNER JOIN discount d ON
p.product_id=d.product_id
GROUP BY category
WHERE discount_amount>10;
/*
ERRORS FOUND :
Missing parentheses around aggregate function AVG, missing FROM clause after GROUP BY, WHERE clause should be after GROUP BY
*/
CORRECTED QUERY :
SELECT category, AVG(price)
FROM product p
INNER JOIN discount d ON p.product_id=d.product_id
WHERE discount_amount > 10
GROUP BY category;
SELECT *
FROM subscriptions AS s1
LEFT JOIN subscriptions AS s2
ON s1.user_id != s2.user_id
AND s1.start_date <= s2.end_date
AND s1.end_date >= s2.start_date