Skip to content

Instantly share code, notes, and snippets.

@andreyuhai
Created December 4, 2018 14:12
Show Gist options
  • Save andreyuhai/e8b891292b7eb15eb70a5dc553450c96 to your computer and use it in GitHub Desktop.
Save andreyuhai/e8b891292b7eb15eb70a5dc553450c96 to your computer and use it in GitHub Desktop.
Compare AVG with some other cell
select
cust_id,
gender,
weight
from customer c
WHERE weight > (SELECT AVG(weight)
FROM customer
WHERE gender = c.gender)
order by c.gender
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment